How to create a reusable UI component
<p>This seems like a simple question that I should be able to find easily but I'm having trouble understanding exactly how to create a reusable UI component for Android. Specifically I'm trying to create this snippet that I use EVERYWHERE into a reusable component to make the code smaller.</p>

<pre><code>&lt;RelativeLayout
    android:layout_width="fill_parent" 
    android:layout_height="fill_parent"
    android:paddingBottom="0dp"
    android:paddingLeft="10dp"
    android:paddingRight="10dp"
    android:paddingTop="10dp"&gt;          
    &lt;TextView
        android:layout_width="wrap_content" 
        android:layout_height="wrap_content"
        android:layout_alignParentLeft="true"
        android:textColor="@color/text_normal"
        android:id="@+id/my_text_id"
        android:text="My field"/&gt;

    &lt;TextView 
        android:layout_width="wrap_content" 
        android:layout_height="wrap_content"
        android:layout_alignParentRight="true"
        android:textColor="@color/text_normal"
        android:text="My value"
        android:id="@+id/my_value_id"/&gt;

&lt;/RelativeLayout&gt;
</code></pre>

<p>These are used like this</p>

<pre><code>&lt;ScrollView xmlns:android="http://schemas.android.com/apk/res/android"
    android:background="@color/background_normal"
    android:layout_width="fill_parent"
        android:layout_height="fill_parent"&gt;
    &lt;LinearLayout
      android:orientation="vertical"
      android:layout_width="fill_parent"
      android:layout_height="fill_parent"&gt;
          &lt;RelativeLayout
             android:layout_width="fill_parent" 
             android:layout_height="fill_parent"
             android:paddingBottom="0dp"
             android:paddingLeft="10dp"
             android:paddingRight="10dp"
             android:paddingTop="10dp"&gt;         
             &lt;TextView
                android:layout_width="wrap_content" 
                android:layout_height="wrap_content"
                android:layout_alignParentLeft="true"
                android:textColor="@color/text_normal"
                android:id="@+id/my_text_id"
                android:text="My field"/&gt;

             &lt;TextView 
                android:layout_width="wrap_content" 
                android:layout_height="wrap_content"
                android:layout_alignParentRight="true"
                android:textColor="@color/text_normal"
                android:text="My value"
                android:id="@+id/my_value_id"/&gt;

          &lt;/RelativeLayout&gt;
    &lt;/LinearLayout&gt;
    &lt;LinearLayout
      android:orientation="vertical"
      android:layout_width="fill_parent"
      android:layout_height="fill_parent"&gt;
          &lt;RelativeLayout
             android:layout_width="fill_parent" 
             android:layout_height="fill_parent"
             android:paddingBottom="0dp"
             android:paddingLeft="10dp"
             android:paddingRight="10dp"
             android:paddingTop="10dp"&gt;         
             &lt;TextView
                android:layout_width="wrap_content" 
                android:layout_height="wrap_content"
                android:layout_alignParentLeft="true"
                android:textColor="@color/text_normal"
                android:id="@+id/my_text_id2"
                android:text="My field2"/&gt;

             &lt;TextView 
                android:layout_width="wrap_content" 
                android:layout_height="wrap_content"
                android:layout_alignParentRight="true"
                android:textColor="@color/text_normal"
                android:text="My value2"
                android:id="@+id/my_value_id2"/&gt;

          &lt;/RelativeLayout&gt;
          .... etc ....
    &lt;/LinearLayout&gt;
&lt;/ScrollView&gt;
</code></pre>

<p>I'm hoping to be able to access both text boxes to assign values inside that will be added with the <code>&lt;include /&gt;</code> tag to a layout. Does anyone know how to do this?</p>

<p>I've seen <a href="http://developer.android.com/resources/articles/layout-tricks-reuse.html" rel="nofollow">http://developer.android.com/resources/articles/layout-tricks-reuse.html</a> but I don't seem to see how to assign multiple of the same field.</p>

<p>Any help is appreciated.</p>

<p><strong>Update</strong> These are used to put a TextView on the left of the screen and another on the right that are lined up together. Not sure how to describe it, but these are used in a ScrollView.</p>
