有没有办法可以为PreferenceActivity应用自定义样式,它将从Theme.Sherlock.Light或Theme.Light继承并保留preferenceDialog和AlertDialogs的黑暗样式? 我可以轻松地将对话框排除在应用光样式之外吗? 如果没有我应该设置哪些属性,在浅色主题中分隔符,文本活动,非活动,标题和副标题等中使用的默认颜色的参数是什么? 谢谢。
Is there a way that I could apply a custom style for an PreferenceActivity, which will inherit from Theme.Sherlock.Light or Theme.Light and keep the dark style for the preferenceDialog and AlertDialogs? Can I easily exclude dialogs from applying light style? if no which attributes should I set and what are the parameters of the default colors used in dividers, text active, inactive, titles and subtitles etc. in light theme? Thanks.
最满意答案
我通过将活动主题更改为光来解决它,然后我以编程方式将警报对话框的主题设置为黑暗的,内置的android样式之一:
this.setTheme(android.R.style.Theme_Holo_Dialog);由于PreferenceDialog继承自Dialog,因此它也将此主题设置为所有PreferenceDialogs。 为了更具体,并为特定对话框添加样式,您可以使用在android源代码中的Dialog.java中使用的ContextThemeWrapper:
builder = new AlertDialog.Builder(new ContextThemeWrapper(this, android.R.style.Theme_DeviceDefault_Dialog))I solved it by changing the activity theme to light and then I set programmatically the theme of the alert dialog to the one of the dark, built in android styles:
this.setTheme(android.R.style.Theme_Holo_Dialog);Since PreferenceDialog inherits from Dialog it also set this theme to all PreferenceDialogs. To be more specific and add a style to a particular dialog you can use ContextThemeWrapper as used in Dialog.java in android source:
builder = new AlertDialog.Builder(new ContextThemeWrapper(this, android.R.style.Theme_DeviceDefault_Dialog))更多推荐
style,样式,light,电脑培训,计算机培训,IT培训"/> <meta name="description&qu
发布评论