3

にカスタム テーマを適用しようとしていActionBarますPreferenceFragment。以下はシーンです。

私のクラスは拡張PreferenceFragmentされ、次のようにリソースから設定を追加しています。

addPreferenceFromResource (R.xml.myPrefs);

また、私は書いています:

ActionBar a = getActivity ().getActionBar ();
bar.setNavigationMode (ActionBar.NAVIGATION_MODE_TABS);

styles.xmlここで、定義した独自のテーマをこのアクション バーに適用したいと思います。現在、アクション バーの高さは、ビューが切り取られているため、タブ ビューよりも小さくなっています。

検索してみましたが、問題の解決策が見つかりませんでした。

  1. " Fragment のテーマを設定"
  2. https://groups.google.com/forum/#!topic/android-developers/GX_gOAN2nmM

上記の 1. と 2. のリンクから、次のことがわかりました。

final Context contextThemeWrapper = new ContextThemeWrapper(getActivity(),R.style.yourCustomTheme);

// clone the inflater using the ContextThemeWrapper
LayoutInflater localInflater = inflater.cloneInContext(contextThemeWrapper);

// inflate the layout using the cloned inflater, not default inflater
return localInflater.inflate(R.layout.yourLayout, container, false);

しかし、これもうまくいきませんでした。

どんな助けでも大歓迎です。

4

1 に答える 1