我已根据http://jgilfelt.github.io/android-actionbarstylegenerator为我的应用生成自定义样式。
但是,当我尝试集成到我的应用程序中时,该样式不适用于我的某个页面的fragmenttabhost。该风格的其余部分适用于我的动作栏等。
以下是我的fragmenttabhost
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>