Книга: 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

Оглавление книги

Оглавление статьи/книги

Генерация: 1.123. Запросов К БД/Cache: 3 / 1
поделиться
Вверх Вниз