title: How to create a neat two-columns input form in Android?
body: <p>I want to create a neat two-columns input form like this:</p>
  
  <p><img src="https://i.stack.imgur.com/eHi7Z.png" alt="http://img31.imageshack.us/img31/115/addnew2.png"></p>
  
  <p>My xml layout code so far:</p>
  
  <pre><code>&lt;?xml version="1.0" encoding="utf-8"?&gt;
  &lt;LinearLayout xmlns:android="http://schemas.android.com/apk/res/android"
      android:layout_width="fill_parent"
      android:layout_height="wrap_content"
      android:orientation="vertical" &gt;
  
      &lt;LinearLayout
          android:layout_width="fill_parent"
          android:layout_height="wrap_content"
          android:orientation="horizontal" &gt;
  
          &lt;TextView
              android:layout_width="0dp"
              android:layout_height="wrap_content"
              android:layout_weight="0.25"
              android:text="@string/lblTitle" /&gt;
  
          &lt;EditText
              android:id="@+id/txtTitle"
              android:layout_width="0dp"
              android:layout_height="wrap_content"
              android:layout_weight="0.75"
              android:ems="10" /&gt;
      &lt;/LinearLayout&gt;
  
      &lt;LinearLayout
          android:layout_width="fill_parent"
          android:layout_height="wrap_content"
          android:orientation="horizontal" &gt;
  
          &lt;TextView
              android:layout_width="0dp"
              android:layout_height="wrap_content"
              android:layout_weight="0.25"
              android:text="@string/lblAuthor" /&gt;
  
          &lt;EditText
              android:id="@+id/txtAuthor"
              android:layout_width="0dp"
              android:layout_height="wrap_content"
              android:layout_weight="0.75"
              android:ems="10" /&gt;
      &lt;/LinearLayout&gt;
  
      &lt;LinearLayout
          android:layout_width="fill_parent"
          android:layout_height="wrap_content"
          android:orientation="horizontal" &gt;
  
          &lt;TextView
              android:layout_width="0dp"
              android:layout_height="wrap_content"
              android:layout_weight="0.25"
              android:text="@string/lblPublisher" /&gt;
  
          &lt;EditText
              android:id="@+id/txtPublisher"
              android:layout_width="0dp"
              android:layout_height="wrap_content"
              android:layout_weight="0.75"
              android:ems="10" /&gt;
      &lt;/LinearLayout&gt;
  
      &lt;LinearLayout
          android:layout_width="fill_parent"
          android:layout_height="wrap_content"
          android:orientation="horizontal" &gt;
  
          &lt;TextView
              android:layout_width="0dp"
              android:layout_height="wrap_content"
              android:layout_weight="0.25"
              android:text="@string/lblIsbn" /&gt;
  
          &lt;EditText
              android:id="@+id/txtIsbn"
              android:layout_width="0dp"
              android:layout_height="wrap_content"
              android:layout_weight="0.75"
              android:ems="10" /&gt;
      &lt;/LinearLayout&gt;
  
      &lt;LinearLayout
          android:layout_width="fill_parent"
          android:layout_height="wrap_content"
          android:orientation="horizontal" &gt;
  
          &lt;View
              android:layout_width="0dp"
              android:layout_height="wrap_content"
              android:layout_weight="0.25" /&gt;
  
          &lt;Button
              android:id="@+id/btnSubmit"
              android:layout_width="0dp"
              android:layout_height="wrap_content"
              android:layout_weight="0.375"
              android:text="@string/submit" /&gt;
  
          &lt;Button
              android:id="@+id/btnCancel"
              android:layout_width="0dp"
              android:layout_height="wrap_content"
              android:layout_weight="0.375"
              android:text="@string/cancel" /&gt;
      &lt;/LinearLayout&gt;
  
  &lt;/LinearLayout&gt;
  </code></pre>
  
  <p>You can see that I used LinearLayout utilizing layout_weight &amp; layout_width="0dp" trick to make the two columns division looks neat. In HTML code, we can use  with % width size. But in android xml layout, there is no %-value for layout_width. I want to avoid hardcoded dp-values for column width. Is it possible in android?</p>
  
  <p>So far that's the best I can do. Now I want to resize the ISBN textbox to become smaller (50% size less from the current size). But I cannot resize the textbox width since layout_width must be "0dp" for layout_weight to work. I also want to do the same with the Submit and Cancel button size.</p>
  
  <p>I wonder if using LinearLayout is a correct way to create input form neatly in android. Could TableLayout better for this? I heard that you cannot change child view's layout_width in TableLayout.</p>
  
  <p>There are some people here recommend me using RelativeLayout, I tried it but it doesn't support layout_weight.</p>