Android 自定义样式可以';无法在对话框构造函数上检测到?
我在Android 自定义样式可以';无法在对话框构造函数上检测到?,android,eclipse,android-styles,Android,Eclipse,Android Styles,我在res/values中有一个自定义样式文件(style.xml),如下所示: <?xml version="1.0" encoding="utf-8"?> <resources> <style name="CustomDialogTheme" parent="@android:style/Theme.Dialog"> <item name="android:windowBackground">@null</item
res/values
中有一个自定义样式文件(style.xml
),如下所示:
<?xml version="1.0" encoding="utf-8"?>
<resources>
<style name="CustomDialogTheme" parent="@android:style/Theme.Dialog">
<item name="android:windowBackground">@null</item>
<item name="android:windowNoTitle">true</item>
</style>
</resources>
@空的
真的
我专门为删除我的对话框的默认白色框架而制作。
但是当我创建dialog对象时,Eclipse
找不到样式(CustomDialogTheme
),因为我应该将它作为dialog
构造函数的参数传递(dialog(getParent(),android.R.style.CustomDialogTheme)
)。我一个接一个地寻找第二个参数,比如Android(然后菜单出现=>R.style.
(现在没有名为CustomDialogTheme
)的样式)
我现在应该使用什么替代方法,请不要建议我使用
AlertDialog
,因为我已经将它从AlertDialog
更改为Dialog
您尝试过吗
R.style.CustomDialogTheme only
Dialog(getParent(),R.style.CustomDialogTheme)
由于
android.R.style
我认为它将预定义的样式定义为android.R.style,以及我们直接使用属于当前应用程序的R.style的任何自定义创建的布局、样式或主题请将style.xml的名称更改为任何其他名称,然后尝试使用R.style.CustomDialogTheme。