Sliding between multiple views using custom adapter
<p>I am trying trying to create a gallery application that slides between three different xml layouts. Application looks quite wrong:</p>

<p><img src="http://i.stack.imgur.com/Tw53T.png" alt="enter image description here"></p>

<p>My XML files are:</p>

<pre><code>linear.xml:
&lt;LinearLayout xmlns:android="http://schemas.android.com/apk/res/android"
          android:orientation="vertical"
          android:layout_width="fill_parent"
          android:layout_height="fill_parent"
    &gt;
&lt;EditText
        android:layout_width="fill_parent"
        android:layout_height="wrap_content"
        android:text="one"/&gt;
&lt;EditText
        android:layout_width="fill_parent"
        android:layout_height="wrap_content"
        android:text="two"
        android:gravity="center"
        android:layout_weight="1"/&gt;
&lt;EditText
        android:layout_width="wrap_content"
        android:layout_height="wrap_content"
        android:text="three"
        android:layout_gravity="right"/&gt;
&lt;/LinearLayout&gt;

table.xml:
&lt;TableLayout xmlns:android="http://schemas.android.com/apk/res/android"
          android:layout_width="fill_parent"
          android:layout_height="fill_parent"&gt;
&lt;TextView android:text="What is your name?"
          android:layout_height="wrap_content"
          android:layout_width="wrap_content"
          android:gravity="center"/&gt;
&lt;TableRow&gt;
    &lt;TextView android:text="@string/firstname"
              android:layout_height="wrap_content"
              android:layout_width="wrap_content" /&gt;
    &lt;EditText android:text="John"
              android:layout_height="wrap_content"
              android:layout_width="wrap_content" /&gt;
&lt;/TableRow&gt;
&lt;TableRow&gt;
    &lt;TextView android:text="@string/lastname"
              android:layout_height="wrap_content"
              android:layout_width="wrap_content" /&gt;
    &lt;EditText android:text="Poe"
              android:layout_height="wrap_content"
              android:layout_width="wrap_content" /&gt;
&lt;/TableRow&gt;
&lt;/TableLayout&gt;

and the gallery.xml:
&lt;Gallery xmlns:android="http://schemas.android.com/apk/res/android"
android:id="@+id/gallery"
android:layout_width="fill_parent"
android:layout_height="fill_parent"/&gt;
</code></pre>

<p>My implementation of BaseAdapter:</p>

<pre><code>public class LayoutsAdapter extends BaseAdapter {
    private LayoutInflater mInflater;

    public LayoutsAdapter(Context context) {
        mInflater = LayoutInflater.from(context);
    }

    @Override
    public int getCount() {
        return 3;
    }

    @Override
    public Object getItem(int i) {
        switch (i) {
            case 0:
                return R.layout.linear;
            case 1:
                return R.layout.table;
            case 2:
                return R.layout.relative;
            default:
                return -1;
        }
    }

    @Override
    public long getItemId(int i) {
        return i;
    }

    @Override
    public View getView(int i, View convertView, ViewGroup viewGroup) {
        convertView = mInflater.inflate((Integer)getItem(i), null);
        return convertView;
    }
}
</code></pre>

<p>I am very new to android, so I am looking forward for your help.</p>
