I have a RelativeLayout with a ViewPager and another LinearLayout. I have set the layout width of the ViewPager as match_parent
and have given the layout height a fixed value of 250dp.
However, when changing the screen sizes bigger and bigger, the height of the ViewPager gets smaller.
How to make the height change according to screen size?
If I set the height to wrap_content
it almost takes up the whole screen except for a smaller bit reserved for the other layout.
The code is posted below.
<RelativeLayout xmlns:android="http://schemas.android.com/apk/res/android"
xmlns:tools="http://schemas.android.com/tools"
android:id="@+id/activity_main"
android:layout_width="match_parent"
android:layout_height="match_parent"
tools:context="com.example.sloid.destinations.navigationdrawerfragments.aboutSLFragment">
<android.support.v4.view.ViewPager
android:id="@+id/viewPager"
android:layout_width="match_parent"
android:layout_height="250dp"
android:layout_marginBottom="8dp"/>
<LinearLayout
android:id="@+id/SliderDots"
android:layout_below="@+id/viewPager"
android:orientation="horizontal"
android:gravity="center_vertical|center_horizontal"
android:layout_width="match_parent"
android:layout_height="wrap_content"/>
</RelativeLayout>