有人可以解释一下此语句为什么运行良好的原因:
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>
最佳答案
尝试使用片段的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/