PJL*_*PJL 19 android android-fragments
基本上我想在清单中设置我的活动的主题如下:
android:theme="@android:style/Theme.Translucent.NoTitleBar"
Run Code Online (Sandbox Code Playgroud)
我希望我的活动加载一个主题为Theme.Holo.Dialog的ListFragment(以我自己的风格定义),但我不能只在我的片段中调用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);
.....
Run Code Online (Sandbox Code Playgroud)
但这不起作用.提前致谢.彼得.
*编辑*发布方式:
<style name="DialogThemeSelector" parent="@android:style/Theme.Holo.Dialog"/>
Run Code Online (Sandbox Code Playgroud)
我只是用简单的方式来做:我使用style属性在 XML 中定义列表项布局,而且它似乎有效。我的列表项不太关心它们是否在片段中。我还没有尝试对片段本身进行样式设置,但由于列表项是其中唯一的内容,因此对它们进行样式设置似乎就足够了。
| 归档时间: |
|
| 查看次数: |
3092 次 |
| 最近记录: |