Comment ajouter une bordure autour de TableLayout?
Ci-dessous mon code de la table. Mon écran ressemble à ceci http://imgur.com/dFP298o mais je veux faire ça ressemble à ça http://imgur.com/YuYJiJx. Comment puis-je ajouter des bordures autour de chaque ligne et autour de disposition de table?
<TableLayout
android:id="@+id/table2"
android:layout_width="fill_parent"
android:layout_below="@+id/test_button_text23"
android:layout_marginLeft="45dp"
android:layout_marginBottom="25dp"
android:layout_marginRight="45dp"
android:layout_height="fill_parent"
android:stretchColumns="*" >
<TableRow
android:layout_width="match_parent"
android:layout_height="match_parent" >
<TextView
android:gravity="left"
android:text="Quantity"
android:textStyle="bold" />
<TextView
android:gravity="center"
android:textStyle="bold"
android:text="Item" />
</TableRow>
</TableLayout>
<?xml version="1.0" encoding="utf-8"?>
<TableRow xmlns:android="http://schemas.android.com/apk/res/android"
android:layout_width="match_parent"
android:layout_height="match_parent" >
<TextView
android:id="@+id/localTime"
android:textColor="#000000"
android:gravity="left" />
<TextView
android:id="@+id/apprentTemp"
android:textColor="#000000"
android:gravity="center" />
</TableRow>
View row = getLayoutInflater().inflate(R.layout.rows, null);
((TextView) row.findViewById(R.id.localTime)).setText(item.getString("Item"));
((TextView) row.findViewById(R.id.apprentTemp)).setText(item.getString("Quantity"));
source d'informationauteur user2589245
Vous devez vous connecter pour publier un commentaire.
Afin de créer une bordure autour de votre table de lignes et autour de la table de mise en page, vous devez créer un drawable pour servir de frontière, puis de le définir comme un fond de vos lignes.
Par exemple:
res/drawable/border.xml
res/layout/your_layout.xml
Ce ne sera pas regarder exactement comme sur la photo que vous avez posté, mais d'en jouer pour obtenir ce que vous voulez.