13
In my xml file I have a Linear layout that has a ViewPager for showing images and another Linear layout that contains previous and Next buttons for selecting images.My xml looks like this:
<?xml version="1.0" encoding="utf-8"?>
<LinearLayout xmlns:android="http://schemas.android.com/apk/res/android"
android:layout_width="match_parent"
android:layout_height="match_parent" >
<android.support.v4.view.ViewPager
android:id="@+id/pager"
android:layout_width="fill_parent"
android:layout_height="wrap_content" />
<LinearLayout
android:layout_width="match_parent"
android:layout_height="wrap_content"
android:gravity="center"
android:orientation="horizontal" >
<Button
android:id="@+id/goto_first"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:text="first" >
</Button>
<Button
android:id="@+id/goto_last"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:text="last" >
</Button>
</LinearLayout>
</LinearLayout>
My problem is that the ViewPager is taking full screen and the Linearlayout with previous next buttons is not showing up because there is no space left to draw this LinearLayout.
I am using Fragments to populate ViewPager with views.The xml file for the fragment view that goes into ViewPager is:
<ImageView
android:id="@+id/ItemImage"
android:layout_width="320dp"
android:layout_height="180dp" />
<TextView
android:id="@+id/ItemText"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:layout_gravity="left|bottom"