该布局如图所示,或者不绘制分割线,只要能突出TextView就行!
1.给加个背景色
2.添加分割线
'
<ImageView
android:layout_width="match_parent"
android:layout_height="1dp"
android:background="@android:color/darker_gray" />
`
3.增加视图高度
在控件中加入
android:elevation="5dp"
可以自定义
1.绘制分割线
在TextView之间放个view就可以了,高度、颜色自己设置,设成灰色较好。
<TextView/>
<View
android:layout_width="match_parent"
android:layout_height="0.5dp"
android:background="@android:color/black"/>
<TextView/>
2.突出TextView也简单,设置TextView的背景色(background)与LinearLayout的背景色(background)
例如:TextView背景为白色,LinearLayout背景色为灰色。
<?xml version="1.0" encoding="utf-8"?>
<LinearLayout xmlns:android="http://schemas.android.com/apk/res/android"
android:orientation="vertical"
android:layout_width="match_parent"
android:background="#eeeeee"
android:layout_height="match_parent">
<TextView
android:layout_width="match_parent"
android:layout_height="wrap_content"
android:text="创建的社团"
android:textSize="16sp"
android:paddingTop="20dp"
android:paddingBottom="20dp"
android:paddingLeft="30dp"
android:background="@android:color/white"
android:layout_marginTop="10dp"/>
<TextView
android:layout_width="match_parent"
android:layout_height="wrap_content"
android:text="加入的社团"
android:textSize="16sp"
android:paddingTop="20dp"
android:paddingBottom="20dp"
android:paddingLeft="30dp"
android:background="@android:color/white"
android:layout_marginTop="10dp"/>
<TextView
android:layout_width="match_parent"
android:layout_height="wrap_content"
android:text="消息"
android:textSize="16sp"
android:paddingTop="20dp"
android:paddingBottom="20dp"
android:paddingLeft="30dp"
android:background="@android:color/white"
android:layout_marginTop="10dp"/>
<TextView
android:layout_width="match_parent"
android:layout_height="wrap_content"
android:text="设置"
android:textSize="16sp"
android:paddingTop="20dp"
android:paddingBottom="20dp"
android:paddingLeft="30dp"
android:background="@android:color/white"
android:layout_marginTop="10dp"/>
<TextView
android:layout_width="match_parent"
android:layout_height="wrap_content"
android:text="退出登录"
android:textSize="16sp"
android:paddingTop="20dp"
android:paddingBottom="20dp"
android:paddingLeft="30dp"
android:background="@android:color/white"
android:layout_marginTop="10dp"/>
</LinearLayout>
我们一般就是用view画线的宽度给个0.5dp即可