title: Android different widths of layouts in ViewPager
body: <p>I want to create some scroll view using Horizontal View Pager. Left view must has full screen width, but right only a quarter of width (it will be a vertical panel like in Dolphin browser). It's possible to do that? I changed <code>android:layout_width</code> in right layout, but it didn't work.</p>
  
  <p>My code:</p>
  
  <pre><code> public class TestActivity extends FragmentActivity {
  
  @Override
  public void onCreate(final Bundle savedInstanceState) {
      super.onCreate(savedInstanceState);
      setContentView(R.layout.main_view);
  
      MyPagerAdapter adapter = new MyPagerAdapter();
      ViewPager pager = (ViewPager) findViewById(R.id.panelPager);
      pager.setAdapter(adapter);
      pager.setCurrentItem(0);
      }
   } 
  </code></pre>
  
  <p>main_view.xml</p>
  
  <pre><code>&lt;LinearLayout xmlns:android="http://schemas.android.com/apk/res/android"
  android:layout_width="fill_parent"
  android:layout_height="fill_parent"
  android:orientation="vertical" &gt;
  
  &lt;android.support.v4.view.ViewPager
      android:id="@+id/panelPager"
      android:layout_width="match_parent"
      android:layout_height="match_parent" /&gt;
  &lt;/LinearLayout&gt;
  </code></pre>
  
  <p>MyPagerAdapter.java</p>
  
  <pre><code>public class MyPagerAdapter extends PagerAdapter {
  
  @Override
  public int getCount() {
      return 2;
  }
  
  @Override
  public Object instantiateItem(final View collection, final int position) {
  
      LayoutInflater inflater =
              (LayoutInflater) collection.getContext().getSystemService(Context.LAYOUT_INFLATER_SERVICE);
  
      int resId = 0;
      switch (position) {
      case 0:
          resId = R.layout.left;
          break;
      case 1:
          resId = R.layout.right;
          break;
      }
  
      View view = inflater.inflate(resId, null);
      ((ViewPager) collection).addView(view, 0);
  
      return view;
  }
  
  @Override
  public void destroyItem(final View arg0, final int arg1, final Object arg2) {
      ((ViewPager) arg0).removeView((View) arg2);
  
  }
  
  @Override
  public boolean isViewFromObject(final View arg0, final Object arg1) {
      return arg0 == ((View) arg1);
  
  }
  </code></pre>
  
  <p>left.xml</p>
  
  <pre><code>&lt;LinearLayout xmlns:android="http://schemas.android.com/apk/res/android"
  android:layout_width="match_parent"
  android:layout_height="match_parent"
  android:orientation="vertical" &gt;
  
  &lt;TextView
      android:id="@+id/textView1"
      android:layout_width="wrap_content"
      android:layout_height="wrap_content"
      android:text="LEFT" /&gt;
  
  &lt;/LinearLayout&gt;
  </code></pre>
  
  <p>right.xml</p>
  
  <pre><code>&lt;LinearLayout xmlns:android="http://schemas.android.com/apk/res/android"
  android:layout_width="50dp"
  android:layout_height="match_parent"
  android:orientation="vertical"
  android:background="@color/light_blue" &gt;
  
  
  &lt;TextView
      android:id="@+id/textView2"
      android:layout_width="fill_parent"
      android:layout_height="wrap_content"
      android:text="RIGHT"/&gt;
  
  &lt;/LinearLayout&gt;
  </code></pre>