整个表格需要使用一个圆角样式背景:
<?xml version="1.0" encoding="utf-8"?> <layer-list xmlns:android="http://schemas.android.com/apk/res/android" > <item> <shape android:shape="rectangle" > <solid android:color="@color/white" /> <corners android:radius="5dp" /> <stroke android:width="1dp" android:color="#e4e2e2" /> </shape> </item> </layer-list>
用水平直线分隔行(horizontal_line.xml):
<?xml version="1.0" encoding="utf-8"?> <shape xmlns:android="http://schemas.android.com/apk/res/android" android:shape="rectangle" > <solid android:color="#e4e2e2" /> <size android:height="1dp" /> </shape>
用竖直直线分隔列(vertical_line.xml):
<?xml version="1.0" encoding="utf-8"?> <shape xmlns:android="http://schemas.android.com/apk/res/android" android:shape="rectangle" > <solid android:color="#e4e2e2" /> <size android:width="1dp" /> </shape>
最后做出来的实际效果(截图后发现直线颜色太暗,手机上看起来效果还行):