android - Fragment getting overlapped in ViewPager -


i getting overlapped fragments in pageviewer of android .

pfb layout pageviewer

<tabhost     android:id="@android:id/tabhost"     android:layout_width="fill_parent"     android:layout_height="900dp"     android:layout_alignparentbottom="true" >    <relativelayout         android:layout_width="fill_parent"         android:layout_height="fill_parent"         android:orientation="vertical" >          <framelayout             android:id="@android:id/tabcontent"             android:layout_width="fill_parent"             android:layout_height="fill_parent"             android:layout_above="@android:id/tabs" >              <android.support.v4.view.viewpager                 android:id="@+id/viewpager"                 android:layout_width="fill_parent"                 android:layout_height="wrap_content" >             </android.support.v4.view.viewpager>         </framelayout>          <tabwidget             android:id="@android:id/tabs"             android:layout_width="match_parent"             android:layout_height="wrap_content"             android:layout_alignparentbottom="true"             android:orientation="horizontal" >         </tabwidget>     </relativelayout> </tabhost> 

i calling via first fragment fragmenta of first tab . need replace fragment a1 calling button click of list baseadapter

fragment duedatefrag = new fieldvisitfragment();             fragmenttransaction ft = fragmentactivity.getsupportfragmentmanager().begintransaction();             ft.replace(android.r.id.tabcontent, duedatefrag);              ft.commit(); 

my fragment gets called overlapped on viewpager . tabs runs below new fragment . kindly

on hindsight , think somewhere nested fragment or child fragment should come play . please guide.

i have used viewpager, extending pageradapter. think you're not referencing correct layout, you're using id/tabcontent. can show example of did, , think can follow same.

in fragment xml:

<linearlayout ... <android.support.v4.view.viewpager         android:id="@+id/viewpager"         android:layout_width="match_parent"         android:layout_height="0px"         android:layout_weight="1"         android:background="@android:color/white" /> ... </linearlayout> 

in fragment code :

mviewpager = (viewpager) view.findviewbyid(r.id.viewpager); 

in viewpager code,

@override public object instantiateitem(viewgroup container, int position) { ... view view = getactivity().getlayoutinflater().inflate(r.layout.pager_item, container, false); ... return view } 

note: did not use fragmenttransaction class displaying fragment or tab view.

keep posted...


Comments

Popular posts from this blog

apache - PHP Soap issue while content length is larger -

asynchronous - Python asyncio task got bad yield -

javascript - Complete OpenIDConnect auth when requesting via Ajax -