Книга: Beginning Android
TableLayout Example
TableLayout Example
The XML layout fragments shown previously, when combined, give us a TableLayout
rendition of the “form” we created for RelativeLayout
, with the addition of a divider line between the label/field and the two buttons (found in the Containers/Table
demo in the Source Code area of http://apress.com):
<?xml version="1.0" encoding="utf-8"?>
<TableLayout
xmlns:android="http://schemas.android.com/apk/res/android"
android:layout_width="fill_parent"
android:layout_height="fill_parent"
android:stretchColumns="1">
<TableRow>
<TextView
android:text="URL:" />
<EditText android:id="@+id/entry"
android:layout_span="3"/>
</TableRow>
<View
android:layout_height="2px"
android:background="#0000FF" />
<TableRow>
<Button android:id="@+id/cancel"
android:layout_column="2"
android:text="Cancel" />
<Button android:id="@+id/ok"
android:text="OK" />
</TableRow>
</TableLayout>
When compiled against the generated Java code and run on the emulator, we get the result shown in Figure 7-7.
Figure 7-7. The TableLayoutDemo sample application
- Chapter 14. Example scripts
- Appendix J. Example scripts code-base
- Example NAT machine in theory
- example rc.firewall
- Example rc.firewall script
- Example rc.DMZ.firewall script
- Example rc.UTIN.firewall script
- Example rc.DHCP.firewall script
- Example rc.flush-iptables script
- Example rc.test-iptables script
- An Example of Conversions in Action
- 6.3.2. Example Web Server Startup Script