记录LinearLayout的一些属性
2019-06-26 本文已影响3人
12313凯皇
-
orientation这个很常用,表示页面元素的方向。有
vertical(纵向)和horizontal(横向)两个可选项。 -
divider分隔符需与下面的
showDividers属性配合使用,否则不起作用。且需是一个drawable,不能只是一个单纯的颜色。下面是一个实例:<!-- myDivider.xml --> <?xml version="1.0" encoding="utf-8"?> <shape xmlns:android="http://schemas.android.com/apk/res/android"> <size android:height="1px" /> <solid android:color="@color/mgjpf_view_divider_color" /> </shape> -
showDividers设置divider分隔符显示的位置有三个值可选:
beginning(第0个child前面),middle(每个child之间),end(最后一个child后面),这些值可以通过|组合起来使用,例如:<LinearLayout xmlns:android="http://schemas.android.com/apk/res/android" android:layout_width="wrap_content" android:layout_height="wrap_content" android:background="@android:color/white" android:divider="@drawable/myDivider" android:orientation="vertical" android:layout_margin="5dp" android:showDividers="middle|beginning">