Android布局文件 分割线

发布时间 2023-11-09 09:43:42作者: 摆渡人19966

要实现这个效果可以用的方法有很多,

1.使用LinearLayout的divider属性

<LinearLayout xmlns:android="http://schemas.android.com/apk/res/android"
    xmlns:app="http://schemas.android.com/apk/res-auto"
    android:layout_width="match_parent"
    android:layout_height="wrap_content"
    android:orientation="vertical"
    android:divider="@drawable/shape_line"
    android:showDividers="middle|end">

divider中的内容表示的是分割线的图形

showDividers表示分割线存在的位置,可以选的内容有 beginning middle end 分别表示开头 组件之间的间隔间 以及结尾处