Tôi đang hiển thị một bố cục bảng, trong đó tôi muốn tách dòng giữa các hàng trong bảng. Ngoài ra, có thể có cột phân tách khôn ngoan trong bố cục bảng.Xin vui lòng trợ giúp tôi.cách nhau giữa các hàng trong bố cục bảng
Sau đây là cách bố trí bảng xml của tôi:
<?xml version="1.0" encoding="utf-8"?>
<LinearLayout xmlns:android="http://schemas.android.com/apk/res/android"
android:layout_width="fill_parent"
android:layout_height="wrap_content"
android:orientation="vertical"
android:paddingBottom="6dip"
android:paddingTop="4dip">
<TableLayout
android:id="@+id/tablelayout"
android:layout_width="fill_parent"
android:layout_height="wrap_content"
android:paddingRight="2dip">
<TableRow>
<TextView
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:text="Income"></TextView>
<TextView
android:layout_width="150px"
android:layout_height="wrap_content"
android:layout_marginLeft="150dp"
android:text="Expense"></TextView>
</TableRow>
<TableRow android:layout_marginTop="30px">
<TextView
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:text="Household:"></TextView>
<TextView
android:id="@+id/text50"
android:layout_width="150px"
android:layout_height="wrap_content"
android:text="Household:"></TextView>
</TableRow>
<TableRow android:layout_marginTop="40px">
<TextView
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:layout_span="2"
android:text="Travel:"></TextView>
<TextView
android:id="@+id/text51"
android:layout_width="150px"
android:layout_height="wrap_content"
android:layout_marginLeft="-250dp"
android:text="Travel"></TextView>
</TableRow>
<TableRow android:layout_marginTop="40px">
<TextView
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:layout_span="2"
android:text="Education:"></TextView>
<TextView
android:id="@+id/text52"
android:layout_width="150px"
android:layout_height="wrap_content"
android:layout_marginLeft="-250dp"
android:text="Education"></TextView>
</TableRow>
</TableLayout>
</LinearLayout>
Như u đang thêm 2 văn bản trong dòng của bảng, thêm một hình ảnh (dòng)/xem như chia giữa văn bản có 2dp.this chiều rộng sẽ làm việc như chia – AkashG
bạn cũng có thể thử loại này. http://stackoverflow.com/questions/2108456/how-can-i-create-a-table-with-borders-in-android hoặc http://stackoverflow.com/questions/7117533/how-to-give-border-of-tế bào-in-tablelayout-in-android – spr