Using TableLayout to create input form : TableLayout « UI « Android






Using TableLayout to create input form

  
package app.test;

import android.app.Activity;
import android.os.Bundle;

public class Test extends Activity {
  @Override
  public void onCreate(Bundle icicle) {
    super.onCreate(icicle);
    setContentView(R.layout.main);
  }
}

//main.xml

<?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>

   
    
  








Related examples in the same category

1.Switch to a TableLayout
2.Using TableLayout and TableRow to display color
3.TableLayout stretchColumns
4.TableLayout and TableRow
5.TableLayout and padding
6.gravity setting inside a TableLayout
7.Code based TableLayout
8.Adding view to TableLayout
9.Shrink a TableLayout
10.Table layout demo
11.Stretch some columns
12.Horizontally centers the content of the cell