<LinearLayout
android:layout_width="match_parent"
android:layout_height="wrap_content" > <Button
android:id="@+id/button1"
android:layout_width="fill_parent"
android:layout_height="wrap_content"
android:text="简单"
android:layout_margin="10px" /> <Button
android:id="@+id/button2"
android:layout_width="fill_parent"
android:layout_height="wrap_content"
android:text="中等"
android:layout_margin="10px" /> <Button
android:id="@+id/button3"
android:layout_width="fill_parent"
android:layout_height="wrap_content"
android:text="较难"
android:layout_margin="10px" />
</LinearLayout>试了半天,不知道要怎么设置属性才能让三个按钮在一条线上均匀的分布?
android:layout_width="match_parent"
android:layout_height="wrap_content" > <Button
android:id="@+id/button1"
android:layout_width="fill_parent"
android:layout_height="wrap_content"
android:text="简单"
android:layout_margin="10px" /> <Button
android:id="@+id/button2"
android:layout_width="fill_parent"
android:layout_height="wrap_content"
android:text="中等"
android:layout_margin="10px" /> <Button
android:id="@+id/button3"
android:layout_width="fill_parent"
android:layout_height="wrap_content"
android:text="较难"
android:layout_margin="10px" />
</LinearLayout>试了半天,不知道要怎么设置属性才能让三个按钮在一条线上均匀的分布?
解决方案 »
- android开发百度题图定位标记问题
- 为什么同一个android程序在不同手机运行结果不一样
- ListView 页脚数据更新,帮忙 哥们 卡了几天了
- 如何在一个界面使用多个listview
- 菜鸟真心求教:SQLite中数据的排序
- 知道了包名,能否得到包里面所有的activity
- 动态添加Layout
- 有没有有名的android 开发公司, 介绍一下!
- JB42 adb devices unauthorized
- 安卓应用开发,应用开启服务在后台运行,息屏一段时间后被关了,找原因和解决方案。
- android刷机后用adb连接,显示有root权限,而手机端却无法获取Root权限
- 怎样让一个activity运行结束以后再运行另一个activity
2. 3个Button的android:layout_width="fill_parent",这是要闹哪样?
3. 均匀是吧,layout_width=0dp并且layout_weight都设为一样的值就好了。
1.可以每个button外面套一个LinearLayout之类的容器,容器均匀分页,button在容器里居中;
2.3个button均匀分布,然后为每个button设置layout_marginLeft和layout_marginRight为一样的值就好了。