Android FragmentTabHost是否不遵循生成的tabstyle?
我已经为基于的应用程序生成了自定义样式 但是,当我尝试集成到我的应用程序中时,该样式对于我的一个页面的fragmenttabhost不起作用。该风格的其余部分对我的actionbar等都很好 下面是我的fragmenttabhostAndroid FragmentTabHost是否不遵循生成的tabstyle?,android,actionbarsherlock,android-tabhost,Android,Actionbarsherlock,Android Tabhost,我已经为基于的应用程序生成了自定义样式 但是,当我尝试集成到我的应用程序中时,该样式对于我的一个页面的fragmenttabhost不起作用。该风格的其余部分对我的actionbar等都很好 下面是我的fragmenttabhost public final class DashBoardFragmentTabHost extends SherlockFragment { private FragmentTabHost mTabHost; public DashBoardFr
public final class DashBoardFragmentTabHost extends SherlockFragment {
private FragmentTabHost mTabHost;
public DashBoardFragmentTabHost()
{
setHasOptionsMenu(true);
}
@Override
public View onCreateView(LayoutInflater inflater, ViewGroup container, Bundle savedInstanceState) {
try{
mTabHost = new FragmentTabHost(getSherlockActivity());
mTabHost.setup(getActivity(), getChildFragmentManager(), R.layout.fragment_tabhost);
mTabHost.addTab(mTabHost.newTabSpec("abc").setIndicator("abc"),
abc.class, null);
mTabHost.addTab(mTabHost.newTabSpec("def").setIndicator("def"),
def.class, null);
mTabHost.addTab(mTabHost.newTabSpec("ghi").setIndicator("ghi"),
ghi.class, null);
//mTabHost.set (getResources().getDrawable(R.drawable.tab_indicator_ab_safetyblue));
}
catch (Exception e) {
// TODO: handle exception
}
return mTabHost;
}
}
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="@+android:id/realtabcontent"
android:layout_width="match_parent"
android:layout_height="0dp"
android:layout_weight="1"/>
</LinearLayout>
</TabHost>
不清楚如何应用这些样式。该生成器设置了操作栏
选项卡的样式,但您使用的是片段选项卡主机
,它封装了一个简单的选项卡主机
(及其组件),该选项卡将不受操作栏
选项卡样式的影响。相反,您需要覆盖当前主题中的tabWidgetStyle
属性(默认情况下,该属性指向Widget.TabWidget
样式)。请提供一个示例方法?