Android Viewpager Under Relativelayout
I am working on ViewPager. I wrote code which can create ViewPager and also I have some java class, but I want my ViewPager must be below the layout. This is a my xml code
Solution 1:
Check It Out, It will help u..
<RelativeLayoutxmlns:android="http://schemas.android.com/apk/res/android"android:layout_width="match_parent"android:layout_height="match_parent"android:background="#fa6a6a" ><RelativeLayoutandroid:id="@+id/relativeLayout1"android:layout_width="fill_parent"android:layout_height="wrap_content"android:background="#171717" ><ImageButtonandroid:id="@+id/menu_button"android:layout_width="wrap_content"android:layout_height="wrap_content"android:layout_centerVertical="true"android:layout_marginLeft="12dp"android:background="@drawable/ic_launcher" /><ImageViewandroid:id="@+id/image"android:layout_width="wrap_content"android:layout_height="7.0mm"android:layout_centerHorizontal="true"android:layout_centerVertical="true"android:background="@drawable/ic_launcher" /><ToggleButtonandroid:id="@+id/button_search"android:layout_width="wrap_content"android:layout_height="wrap_content"android:layout_alignParentRight="true"android:layout_centerVertical="true"android:layout_marginRight="12dp"android:background="@drawable/ic_launcher"android:padding="2dip"android:textOff=""android:textOn="" /></RelativeLayout><RelativeLayoutandroid:layout_width="match_parent"android:layout_height="match_parent"android:layout_alignParentLeft="true"android:layout_below="@+id/relativeLayout1" ><android.support.v4.view.ViewPagerandroid:id="@+id/vp_main"android:layout_width="match_parent"android:layout_height="match_parent" ></android.support.v4.view.ViewPager></RelativeLayout></RelativeLayout>
Solution 2:
Try this :
<RelativeLayoutxmlns:android="http://schemas.android.com/apk/res/android"android:layout_width="match_parent"android:layout_height="match_parent"android:background="#fa6a6a" ><RelativeLayoutandroid:layout_width="match_parent"android:layout_height="match_parent"android:layout_alignParentLeft="true"><android.support.v4.view.ViewPagerandroid:id="@+id/vp_main"android:layout_width="match_parent"android:layout_height="match_parent"></android.support.v4.view.ViewPager></RelativeLayout><RelativeLayoutandroid:id="@+id/relativeLayout1"android:layout_width="fill_parent"android:layout_height="wrap_content"android:background="#171717" ><ImageButtonandroid:id="@+id/menu_button"android:layout_width="wrap_content"android:layout_height="wrap_content"android:layout_centerVertical="true"android:layout_marginLeft="12dp"android:background="@drawable/ic_launcher" /><ImageViewandroid:id="@+id/image"android:layout_width="wrap_content"android:layout_height="7.0mm"android:layout_centerHorizontal="true"android:layout_centerVertical="true"android:background="@drawable/ic_launcher" /><ToggleButtonandroid:id="@+id/button_search"android:layout_width="wrap_content"android:layout_height="wrap_content"android:layout_alignParentRight="true"android:layout_centerVertical="true"android:layout_marginRight="12dp"android:background="@drawable/ic_launcher"android:padding="2dip"android:textOff=""android:textOn="" /></RelativeLayout></RelativeLayout>
Also dont forget to clean your project . Hope it helps
Post a Comment for "Android Viewpager Under Relativelayout"