Monday 10 October 2011

LinearLayout


LinearLayout organizes elements along a single line. You specify whether that line is verticle or horizontal using android:orientation. Here is a sample Layout XML using LinearLayout.
Ex:
<LinearLayout xmlns:android="http://schemas.android.com/apk/res/android"
  android:orientation="horizontal"
  android:layout_width="fill_parent"
    android:layout_height="fill_parent">
     <Button
      android:id="@+id/backbutton"
      android:text="Back"
      android:layout_width="wrap_content"
      android:layout_height="wrap_content" />
    <TextView
      android:text="First Name"
      android:layout_width="wrap_content"
      android:layout_height="wrap_content" />
    <EditText
      android:width="100px"
      android:layout_width="wrap_content"
      android:layout_height="wrap_content" />
<TextView
      android:text="Last Name"
      android:layout_width="wrap_content"
      android:layout_height="wrap_content" />
    <EditText
      android:width="100px"
      android:layout_width="wrap_content"
      android:layout_height="wrap_content" />
</LinearLayout>



No comments:

Post a Comment