Tabhost content not showing when I update android.support.v4

I use TabHost and it worked fine until I updated the support library. When I update the jar, the contents of the tab are not displayed, only the tab is shown.

I am using FragmentActivity .

Here's the XML:

 <android.support.v4.app.FragmentTabHost android:id="@+id/tab_host" style="@style/FillParentWrapContent" android:layout_below="@id/view_location_card" android:layout_marginLeft="@dimen/view_margin" android:layout_marginRight="@dimen/view_margin" > <FrameLayout android:id="@android:id/tabcontent" style="@style/FillParentWrapContent" /> <FrameLayout android:id="@+id/tab_content" android:layout_width="fill_parent" android:layout_height="fill_parent" android:layout_weight="1" android:paddingTop="@dimen/view_margin_extra_large" /> </android.support.v4.app.FragmentTabHost> 

Code snippet:

 FragmentTabHost tabHost = (FragmentTabHost) findViewById(R.id.tab_host); tabHost.setup(this, getSupportFragmentManager(), R.id.tab_content); Bundle bundle = new Bundle(); bundle.putInt(CommonConstants.TAB_ID, tabTitleId); tabHost.addTab(tabHost.newTabSpec("Title").setIndicator(tabView), Fragment.class, bundle); 

Please help me with this. I need to upgrade lib because I am using a new feature like GPS resolution Marshmallow.

I think this problem is due to the fact that the tabs are full width, so our ListView has no place to display content.

+5
source share
1 answer

Try inserting tabwidget like:

 <android.support.v4.app.FragmentTabHost android:id="@android:id/tabhost" android:layout_width="match_parent" android:layout_height="wrap_content" /> <LinearLayout android:layout_width="match_parent" android:layout_height="match_parent" android:orientation="vertical" > <TabWidget android:id="@android:id/tabs" android:layout_width="match_parent" android:layout_height="wrap_content" android:layout_weight="0" android:orientation="horizontal" /> <FrameLayout android:id="@android:id/tabcontent" android:layout_width="0dp" android:layout_height="0dp" android:layout_weight="0" /> <FrameLayout android:id="@+id/tab_content" android:layout_width="match_parent" android:layout_height="0dp" android:layout_weight="1" android:paddingTop="@dimen/view_margin_extra_large" /> </LinearLayout> </android.support.v4.app.FragmentTabHost> 
+1
source

All Articles