【发布时间】:2011-05-25 08:32:13
【问题描述】:
基本上我想在清单中设置我的活动主题如下:
android:theme="@android:style/Theme.Translucent.NoTitleBar"
并且我希望我的活动加载一个 ListFragment 主题为 Theme.Holo.Dialog(以我自己的风格定义),但是我不能在我的片段中尽可能地调用 setStyle(....)如果它是一个 DialogFragment。
我相信我应该能够使用 ContextThemeWrapper,但我无法理解我需要拨打的电话。到目前为止,在我的 onCreateView 中我有:
@Override
public View onCreateView(LayoutInflater inflater, ViewGroup container, Bundle savedInstanceState) {
LayoutInflater newInflater = inflater.cloneInContext(new ContextThemeWrapper(getActivity(), R.style.DialogThemeSelector));
View inflatedView = newInflater.inflate(R.layout.favourites_print, container, false);
.....
但这不起作用。提前致谢。彼得。
*编辑 * 发帖风格:
<style name="DialogThemeSelector" parent="@android:style/Theme.Holo.Dialog"/>
【问题讨论】: