Linearlayout的android:divider属性

来源:互联网 发布:图的深度优先遍历算法 编辑:程序博客网 时间:2024/05/22 02:11
  • 这个属性可以在LinearLayout的每个子布局直间添加一个“drawable”作为分割线,这个drawable必须有设定好的高度或者宽度,因此不能之间设置为“@color/….”
  • 这个属性要和android:showDividers一起使用才会生效
  • android:showDividers有“begining”,“middle”,“end”,“none”四种值。默认值为“none”,即不显示分割线。

android:showDividers=”beginning”

<LinearLayout    android:id="@+id/container"    android:layout_width="match_parent"    android:layout_height="wrap_content"    android:showDividers="beginning"    android:orientation="vertical"    android:divider="@drawable/list_divider"    android:padding="@dimen/margin_normal">    <Button        android:text="sdf"        android:layout_width="wrap_content"        android:layout_height="wrap_content" />    <Button        android:text="sdf"        android:layout_width="wrap_content"        android:layout_height="wrap_content" />    <Button        android:text="sdf"        android:layout_width="wrap_content"        android:layout_height="wrap_content" /></LinearLayout>

只有第一个子控件上面有一条分割线
这里写图片描述

android:showDividers=”middle”

每个子空间之间都有一条分割线
这里写图片描述

android:showDividers=”end”

只有最后一个子控件有一条分割线
这里写图片描述

0 0
原创粉丝点击