Table layout contains rows and columns. The Rows are defined in the layout XML, and the Columns are determined automatically by Android.
> Table Layout containers do not display border lines for their rows, columns, or cells. Each row has zero or more cells; each cell can hold one View object.
Table Row
> A Table Row should always be used as a child of a Table Layout. If a TableRow's parent is not a Table Layout, the TableRow will behave as an horizontal Linear Layout.
Here is the example for table layout.
<?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">
<TableRow>
<TextView
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:text="Name"
/>
<EditText
android:layout_width="wrap_content"
android:layout_weight="2"
android:layout_height="wrap_content"
android:hint="Enter your Name"
/>
</TableRow>
<TableRow>
<TextView
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:text="Password"
/>
<EditText
android:layout_width="wrap_content"
android:layout_weight="2"
android:layout_height="wrap_content"
android:hint="Enter your Password"
/>
</TableRow>
<TableRow>
<TextView
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:text="Email"
/>
<EditText
android:layout_width="wrap_content"
android:layout_weight="2"
android:layout_height="wrap_content"
android:hint="Enter your Mail ID"
/>
</TableRow>
<TableRow>
<TextView
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:text="City"
/>
<EditText
android:layout_width="wrap_content"
android:layout_weight="2"
android:layout_height="wrap_content"
android:hint="Enter your City"
/>
</TableRow>
<TableRow
android:gravity="center"
>
<Button
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:text="Click Here.."
/>
</TableRow>
</TableLayout>
See the output Screen
More about TableLayout click here..
> Table Layout containers do not display border lines for their rows, columns, or cells. Each row has zero or more cells; each cell can hold one View object.
Table Row
> A Table Row should always be used as a child of a Table Layout. If a TableRow's parent is not a Table Layout, the TableRow will behave as an horizontal Linear Layout.
Here is the example for table layout.
<?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">
<TableRow>
<TextView
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:text="Name"
/>
<EditText
android:layout_width="wrap_content"
android:layout_weight="2"
android:layout_height="wrap_content"
android:hint="Enter your Name"
/>
</TableRow>
<TableRow>
<TextView
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:text="Password"
/>
<EditText
android:layout_width="wrap_content"
android:layout_weight="2"
android:layout_height="wrap_content"
android:hint="Enter your Password"
/>
</TableRow>
<TableRow>
<TextView
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:text="Email"
/>
<EditText
android:layout_width="wrap_content"
android:layout_weight="2"
android:layout_height="wrap_content"
android:hint="Enter your Mail ID"
/>
</TableRow>
<TableRow>
<TextView
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:text="City"
/>
<EditText
android:layout_width="wrap_content"
android:layout_weight="2"
android:layout_height="wrap_content"
android:hint="Enter your City"
/>
</TableRow>
<TableRow
android:gravity="center"
>
<Button
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:text="Click Here.."
/>
</TableRow>
</TableLayout>
More about TableLayout click here..
No comments:
Post a Comment