をとしてContext.getTheme()使用すると、通常はうまく機能しません。ApplicationContext
MyApplication.singletonInstance().getTheme().resolveAttribute(R.attr.actionBarDeleteIcon, typedValue, true);
// typedValue.resourceId will be 0x0, which is invalid
ただし、Activityコンテキストとして使用すると、うまく機能します
MyFragment.this.getActivity().getTheme().resolveAttribute(R.attr.actionBarDeleteIcon, typedValue, true);
// typedValue.resourceId is valid
なぜ属性を解決できないのだろうと思っていましたApplicationか?
マニフェストでは、特定のテーマ情報がApplicationレベルで見つかります。したがって、Applicationオブジェクトからテーマを取得することは理にかなっていると思いました。
<application
android:theme="..."