gpt4 book ai didi

android - 如何为DialogFragment设置主题

转载 作者:可可西里 更新时间:2023-11-01 19:10:08 25 4
gpt4 key购买 nike

谁能解释一下为什么这个语句非常有效:

setStyle(DialogFragment.STYLE_NO_TITLE, android.R.style.Theme_Holo);

并且下一个语句没有交付

setStyle(DialogFragment.STYLE_NO_TITLE, R.style.dialog);

这是我在样式部门拥有的:

<style
name="dialog">
<!-- title encapsulating main part (backgroud) of custom alertdialog -->
<item
name="android:windowFrame">@null</item>
<!-- turn off any drawable used to draw a frame on the window -->
<item
name="android:windowBackground">@null</item>
<!-- turn off any drawable used to draw a frame on the window -->
<item
name="android:windowIsFloating">true</item>
<!-- float the window so it does not fill the screen -->
<item
name="android:windowNoTitle">true</item>
<!-- remove the title bar we make our own-->
<item
name="android:windowContentOverlay">@null</item>
<!-- remove the shadow from under the title bar -->
</style>

最佳答案

尝试使用 fragment 的 onCreate 中的代码作为

@Override
public void onCreate(Bundle savedInstanceState) {
super.onCreate(savedInstanceState);

setStyle(DialogFragment.STYLE_NO_TITLE, R.style.dialog);
}

关于android - 如何为DialogFragment设置主题,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/17113826/

25 4 0
Copyright 2021 - 2024 cfsdn All Rights Reserved 蜀ICP备2022000587号
广告合作:1813099741@qq.com 6ren.com