Android Layouts: Tableview
Can anyone tell me how to make my sample below
Solution 1:
Use ImageButton instead of Button, and use a nested LinearLayout in each table cell to center the text correctly under each button :
<TableRow><LinearLayoutandroid:orientation="vertical"android:layout_width="wrap_content"android:layout_height="wrap_content" ><ImageButtonandroid:layout_gravity="center_horizontal"android:layout_width="wrap_content"android:layout_height="wrap_content"android:background="#00000000"android:src="@drawable/icon" /><TextViewandroid:layout_gravity="center_horizontal"android:layout_width="wrap_content"android:layout_height="wrap_content"android:padding="2dip"android:text="News Feed"/></LinearLayout><LinearLayout>
...
</LinearLayout></TableRow>Notice android:layout_gravity="center_horizontal" which centers your view horizontally in the parent view. This code may need some improvements, but it is the general idea you should follow (use layout_gravity, nested layouts, and ImageButtons).
You can also improve your table layout so it will use the whole space available :
<TableLayoutandroid:layout_height="wrap_content"android:layout_width="wrap_content"android:stretchColumns="*" >
Post a Comment for "Android Layouts: Tableview"