TabHost 中的选项卡始终处于选中状态

Tab always selected in TabHost

我的 TabHost 有问题,在 Fragment 中,第一个要选择的选项卡将始终突出显示,所以我经常选择两个选项卡,如下所示

此处通知不应突出显示!

但问题只出现在通知标签上,正如你在这里看到的标签朋友表现正常,因为它是第二个添加..

这是我保存 TabHost 的片段的代码

public class ProfileContentFragment extends Fragment {
private FragmentTabHost mTabHost;
public ProfileContentFragment() {
}

public void onCreate(Bundle savedInstanceState) {
    super.onCreate(savedInstanceState);

}

public View onCreateView(LayoutInflater inflater, ViewGroup container,
                         Bundle savedInstanceState) {

    View rootView = inflater.inflate(R.layout.profile_content_fragment,container, false);


    mTabHost = (FragmentTabHost)     rootView.findViewById(android.R.id.tabhost);
    mTabHost.setup(getActivity(), getFragmentManager(),      android.R.id.tabcontent);

              mTabHost.addTab(mTabHost.newTabSpec("notifications").setIndicator("Notifications    "),
            NotificationsFragment.class, null);

    mTabHost.addTab(mTabHost.newTabSpec("friends").setIndicator("Friends"),
            FriendsFragment.class, null);

    return rootView;
}

@Override
public void onDestroyView(){
    super.onDestroyView();;
    mTabHost=null;
}
}

这里是 XML

<?xml version="1.0" encoding="utf-8"?>
<RelativeLayout xmlns:android="http://schemas.android.com/apk/res/android"
android:layout_width="match_parent"
android:layout_height="match_parent"
android:orientation="vertical">

<android.support.v4.app.FragmentTabHost
xmlns:android="http://schemas.android.com/apk/res/android"
android:id="@android:id/tabhost"
    android:layout_width="fill_parent"
    android:layout_height="fill_parent">


        <LinearLayout
            android:id="@+id/LinearLayout01"
            android:orientation="vertical"
            android:layout_height="fill_parent"
            android:layout_width="fill_parent">

            <TabWidget
                android:id="@android:id/tabs"
                android:layout_height="wrap_content"
                android:layout_width="fill_parent">
            </TabWidget>

            <FrameLayout
                android:id="@android:id/tabcontent"
                android:layout_height="fill_parent"
                android:layout_width="fill_parent">
            </FrameLayout>

        </LinearLayout>


</android.support.v4.app.FragmentTabHost>
</RelativeLayout>

已解决:

通过更改

解决了
 mTabHost.setup(getActivity(), getFragmentManager(),     android.R.id.tabcontent);

收件人:

mTabHost.setup(getActivity(), getChildFragmentManager(), android.R.id.tabcontent);