First of all, thank you all for this great community.
I am trying to run sample support demo code to implement fragment tabbed interface.
At the top, I am trying to implement two tabs, associate one fragment with each tab and display fragments when each tab is selected accordingly.
I currently have two problems (but I'm sure they are related ...)
1) Fragments for each tab overlap with each other. This may be due to improper attachment / detachment of the fragment.
2) The third fragment of the mystery is created somewhere and overlaps other fragments, and
On the emulator (and on the physical device), you can see that two fragments overlap when you select one tab
When tab1 is selected, fragment 1 and the unknown fragment overlap.
When tab2 is selected, fragment 1 and fragment 2 overlap.
Links to screenshots (not enough reputation to upload photos ...)
(tab 1 overlaps) http://s8.postimg.org/kv81yz745/tab1_overlapping.png
(tab2 overlaps) http://s8.postimg.org/3tf7wvs91/tab2_overlapping.png
here, I divided the text in each fragment for demonstration / clarity purposes.
Links to these screenshots are given below in my comment / answer. (not enough reputation to download more than two links ...)
Action Layout (fragment_tabs.xml)
<TabHost xmlns:android="http://schemas.android.com/apk/res/android" android:id="@android:id/tabhost" android:layout_width="match_parent" android:layout_height="match_parent"> <LinearLayout android:orientation="vertical" android:layout_width="match_parent" android:layout_height="match_parent"> <TabWidget android:id="@android:id/tabs" android:orientation="horizontal" android:layout_width="match_parent" android:layout_height="wrap_content" android:layout_weight="0"/> <FrameLayout android:id="@android:id/tabcontent" android:layout_width="0dp" android:layout_height="0dp" android:layout_weight="0"/> <FrameLayout android:id="@+id/realtabcontent" android:layout_width="match_parent" android:layout_height="0dp" android:layout_weight="1"/> </LinearLayout> </TabHost>
Source
public class TabbedInfoHome extends SherlockFragmentActivity { TabHost mTabHost; TabManager mTabManager; static String tag1name = "simple1"; static String tag2name = "simple2"; static String tab1string = "You are looking at fragment 1"; static String tab2string = "You are looking at fragment 2"; @Override protected void onCreate(Bundle savedInstanceState) { super.onCreate(savedInstanceState); setContentView(R.layout.fragment_tabs); if (savedInstanceState == null) {