在使用android:layout_weight属性时,控件不能对齐的解决方案
来源:互联网 发布:断点续传java 编辑:程序博客网 时间:2024/05/18 03:24
这个是我写的代码。如果子控件的内容比较多,那么子控件就不能对齐,后来看到鸿洋大神的视频,发现了解决方法,这个要在LinearLayout中加一个android:baselineAligned="false" 这个属性就可以得到我们想要的结果了
<LinearLayout
android:layout_width="match_parent"
android:layout_height="wrap_content"
android:orientation="horizontal" >
<Button
android:id="@+id/frag_btn_item_01"
android:layout_width="match_parent"
android:layout_height="60dp"
android:layout_weight="1"
android:text="Customfdggfd "
android:gravity="center"
android:background="@drawable/item" />
<Button
android:id="@+id/frag_btn_item_02"
android:layout_width="match_parent"
android:layout_height="60dp"
android:layout_weight="1"
android:gravity="center"
android:text="NetWork"
android:background="@drawable/item" />
<Button
android:id="@+id/frag_btn_item_03"
android:layout_width="match_parent"
android:layout_height="60dp"
android:layout_weight="1"
android:gravity="center"
android:text="Audio dsfsd f"
android:background="@drawable/item" />
<Button
android:id="@+id/frag_btn_item_04"
android:layout_width="match_parent"
android:layout_height="60dp"
android:layout_weight="1"
android:text="NOT"
android:gravity="center"
android:background="@drawable/item" />
</LinearLayout>
加完这个属性之后 : android:baselineAligned="false"
阅读全文
0 0
- 在使用android:layout_weight属性时,控件不能对齐的解决方案
- android:layout_weight属性的使用
- android:layout_weight属性的使用
- Android控件属性:Layout_weight
- Android layout_weight属性使用
- 在Android的控件布局中,有一个奇葩的 layout_weight 属性
- layout_weight属性的使用
- android:layout_weight属性使用注意事项
- Android layout_weight 属性使用介绍
- android 布局控件中 Layout_weight属性
- FrameLayout中控件使用属性:layout_weight
- Android手机开发:android:layout_weight属性的使用
- Android的layout_weight属性详解
- Android的layout_weight属性释疑
- Android布局的layout_weight属性
- android Layout_weight属性的详解
- 关于layout_weight属性的使用
- android:layout_weight的使用
- cp: cannot create regular file '/media/lxl/wdd/boot/vxworks-cu2': Read-only file system
- Cygwin搭建hadoop开发环境
- 快速排序
- 《JAVA与模式》之观察者模式
- JAVA创建线程的两种方式
- 在使用android:layout_weight属性时,控件不能对齐的解决方案
- Activity状态转换和Activity栈
- csdn博客被封,解决方法
- MyBatis学习笔记(一)
- liux笔记本合盖继续运行
- ReactNative 自定义机场选择列表 AirportListView
- SteamVR Unity Tool Kit(二):激光与移动
- MySQL中关于JSON你不得不知道的那些事!
- Python语法备忘-常用函数