如题所问
需要在一行中排列4个图片按钮,如何让其自动排列达到间距均匀的效果?
用什么layout容器方便?button需要做什么设置
需要在一行中排列4个图片按钮,如何让其自动排列达到间距均匀的效果?
用什么layout容器方便?button需要做什么设置
解决方案 »
- ubuntu下NDK编译问题
- android显示图片问题
- android中修改xml文件?
- android如何用代码判断屏幕是亮还是暗了?急!请进来接分,谢谢
- android开发资源无法下载(比如说源代码、内核代码等)
- 自定义logo问题求帮助
- 请教高手,Eclipse报出无名错误。
- 【代码】Android开发数据保存的几种方法
- 这个文件在什么地方? (/storage/emulated/0/Download/../update.zip)
- LayoutInflater.inflate(R.id.taskview,null);老是报错!求解!
- 推送技术在android如何实现
- 关于webview的缓存问题
android:layout_weight="1"
如果想要button均匀排列,一般要用到就是设置它的宽度和权值!
button里面一般设置:
android:layout_width
android:layout_weight=“相同的值”
android:id="@+id/widget0"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:orientation="horizontal"> <Button android:text="delete"
android:id="@+id/Button02"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:layout_marginLeft="20px"
android:layout_marginRight="20px">
</Button></LinearLayout>每个button这样设置, 就ok了
android:layout_width="fill_parent"
android:layout_height="fill_parent"
android:shrinkColumns="0,1,2"><!-- have an eye on ! -->
<TableRow><!-- row1 -->
<Button android:id="@+id/button1"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:text=" Button1"
/>
<Button android:id="@+id/button2"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:text=" Button2"
android:layout_column="1"
/>
再填2个
使用LinearLayout,每个Button的 layout_weight设为1
src设为Button的图片背景
background设为#00000000
这样各个Button等间距,图片还不会背拉伸
LinaerLayout、TableLayout、RelativeLayout等,都可以实现该效果
看楼主擅长用哪种了