title: How can I resize my ViewPager depends on the size of my screen?
body: <p>I'm trying to resize my ViewPager depends on the screen size of a device. My ViewPager is at the center of screen and has only a width of 300dp. I want my ViewPager height to resize depends on the screen size. Underneath of my ViewPager  it has a ImageView, this ImageView covers a part of my ViewPager. </p>
  
  <p>In my activity_main.xml</p>
  
  <pre><code>&lt;android.support.v4.view.ViewPager
      android:id="@+id/pager"
      android:layout_width="300dp"
      android:layout_height="match_parent"
      android:layout_below="@+id/img_memtext"
      android:layout_centerHorizontal="true"/&gt;
  
  
  &lt;com.viewpagerindicator.CirclePageIndicator
      android:id="@+id/indicator"
      android:layout_height="wrap_content"
      android:layout_width="wrap_content"
      android:layout_alignParentStart="true"
      android:layout_alignParentLeft="true"
      android:layout_below="@+id/pager"
      android:layout_centerHorizontal="true"/&gt;
  
  &lt;ImageView
      android:layout_width="wrap_content"
      android:layout_height="50dp"
      android:background="@drawable/notification_bg"
      android:layout_alignParentBottom="true"
      android:layout_alignParentStart="true"
      android:layout_alignParentLeft="true"
      android:layout_alignTop="@+id/attention"
      android:layout_below="@id/indicator"/&gt;
  </code></pre>
  
  <p>In my viewpager_item.xml</p>
  
  <pre><code>&lt;?xml version="1.0" encoding="utf-8"?&gt;
  
      &lt;ScrollView
          xmlns:android="http://schemas.android.com/apk/res/android"
          android:layout_width="300dp"
          android:layout_height="wrap_content"
          android:layout_marginRight="10dp"
          android:layout_marginLeft="10dp"
          android:layout_marginTop="5dp"
          android:background="#ffffffff"
          android:isScrollContainer="true"
          android:fillViewport="true"
          android:layout_gravity="center"
          &gt;
  
          &lt;RelativeLayout
              android:layout_width="wrap_content"
              android:layout_height="wrap_content"
              android:padding="5dp"
              &gt;
  
              &lt;ImageView
                  android:layout_width="280dp"
                  android:layout_height="100dp"
                  android:id="@+id/news_image"
                  android:layout_centerHorizontal="true"/&gt;
  
              &lt;TextView
                  android:id="@+id/news_title"
                  android:layout_width="wrap_content"
                  android:layout_height="wrap_content"
                  android:gravity="center"
                  android:textStyle="bold"
                  android:textSize="18dp"
                  android:layout_below="@+id/news_image"/&gt;
  
              &lt;TextView
                  android:id="@+id/space"
                  android:layout_width="20dp"
                  android:layout_height="20dp"
                  android:gravity="center"
                  android:layout_below="@+id/news_title"
                  /&gt;
  
              &lt;TextView
                  android:id="@+id/news_body"
                  android:layout_width="wrap_content"
                  android:layout_height="wrap_content"
                  android:layout_below="@+id/news_title"
                  android:textSize="14dp"/&gt;
  
              &lt;TextView
                  android:id="@+id/read_more"
                  android:layout_width="wrap_content"
                  android:layout_height="wrap_content"
                  android:layout_below="@+id/news_body"
                  android:textColor="#ff28c0ff"
                  android:clickable="true"
                  android:textSize="14dp"/&gt;
  
          &lt;/RelativeLayout&gt;
  
      &lt;/ScrollView&gt;
  </code></pre>
  
  <p>Could anyone can help me please? Thank you very much.</p>