在android布局文件中给一个LinearLayout包裹的TextView绘制分割线?

该布局如图所示,或者不会真分割线,只要能突出TextView就行!
图片说明

先做个shape drawable; butbg.xml


 <shape xmlns:android="http://schemas.android.com/apk/res/android">
    <solid android:color="#dff2ff"/>
    <stroke android:color="#3eb2fe" android:width="1dp" />
</shape>

然后, 把这个drawable设置为textview的background就行了。


 <TextView
        android:layout_width="match_parent"
        android:layout_height="40dp"
        android:text="   Hello World!"
        android:background="@drawable/but_bg"
        android:gravity="center_vertical"/>

搞定! 效果如此
图片说明