android LinearLayout添加分割线

方法一、

   <View

        android:layout_width="match_parent"

        android:layout_height="match_parent"

        android:background="@color/black"/>

注:存在缺点会增加布局绘制时间

方法二、

使用方法

    <LinearLayout

       android:layout_width="match_parent"

       android:layout_height="match_parent"

       android:showDividers="middle|end|beginning|none"

       android:divider="@drawable/layout_line">

    <LinearLayout/>

分割线

@drawable/layout_line

    <?xml version=“1.0” encoding="utf-8"

<shape xmlns:android=“http://schemas.android.com/apk/res/android”>

<solid android:color="@Color/person_back"/>

<size android:height="1dip"/>

直接使用即可

猜你喜欢

转载自blog.csdn.net/weixin_40251830/article/details/79551778