Jan*_* S. 25 android themes android-preferences
大家好我已经在清单文件中设置了这样的主题:
android:theme="@android:style/Theme.Light"
Run Code Online (Sandbox Code Playgroud)
但我在首选项活动中有一个问题,在主要首选项中主题显示确定,但如果我得到一个子偏好,主题变得混乱,它不是白色应该,它是全黑的,字体是黑色,所以你看不到多少,当我开始点击任何项目时,他们有时会变成白色,但很快就会恢复到黑色.这只发生在2.1,在真实设备和仿真器中.在运行1.6的模拟器上测试,它运行正常.以下是首选项xml文件的代码的一部分:
<?xml version="1.0" encoding="utf-8"?>
<PreferenceScreen
xmlns:android="http://schemas.android.com/apk/res/android">
<PreferenceScreen
android:title="@string/account">
<CheckBoxPreference
android:key="enable_account"
android:title="@string/account_use"
android:summary="@string/account_summ" />
<EditTextPreference
android:key="username"
android:title="@string/login"
android:dependency="enable_account"
android:summary="@string/login_summ" />
<EditTextPreference
android:key="password"
android:title="@string/password"
android:dependency="enable_account"
android:summary="@string/password_summ"
android:password="true" />
</PreferenceScreen>
Run Code Online (Sandbox Code Playgroud)
这是一个截图:
替代文字http://i39.tinypic.com/16hnhh3.png
任何解决方法?
Ale*_*man 15
有人刚刚在http://code.google.com/p/android/issues/detail?id=4611上发布了一个解决方法
简而言之,顶级首选项屏幕似乎识别主题,但嵌套的主题不是.因此,变通方法建议为嵌套的PreferenceScreen创建顶级PreferenceActivity,然后通过intent调用此新活动:
<PreferenceScreen android:key="key1"
android:title="1 Item"
android:summary="">
<intent android:action="android.intent.action.VIEW"
android:targetPackage="com.example"
android:targetClass="com.example.PreferenceActivity2"/>
</PreferenceScreen>
Run Code Online (Sandbox Code Playgroud)
除了应用程序本身,我没有必要将主题应用于任何东西.
| 归档时间: |
|
| 查看次数: |
13871 次 |
| 最近记录: |