<View android:layout_width="match_parent" android:layout_height="1dp" android:background="@color/orange_normal" />效果图
在drawable文件夹里用 shape line 或 rectangle 先画线
方法2:在drawable里面用shape新建一个xml
然后在 layout 里的布局文件里引用
这种方法 可以 多处引用同一个 line 样式
<!-- drawable/line_my.xml --><shape xmlns:android="http://schemas.android.com/apk/res/android" android:shape="line" > <stroke android:color="@color/orange_normal" /></shape>或者用填充的矩形实现
<shape xmlns:android="http://schemas.android.com/apk/res/android" android:shape="rectangle" > <solid android:color="@color/orange_normal" /> <sizeandroid:height="1dp"android:width="100dp" /></shape>Note
<TextView android:layout_width="match_parent" android:layout_height="wrap_content" android:background="@drawable/line_my" />希望本文所述对大家学习Android软件编程有所帮助。