GFl*_*lam 10 java xml android preferencescreen
我的应用程序中有以下首选项屏幕
<PreferenceScreen
xmlns:android="http://schemas.android.com/apk/res/android">
<EditTextPreference
android:key="edittexvalue"
android:id="@+id/edittextvalue"
android:title="Title Here"
android:summary="Summary Here"
android:defaultValue="Some Value"/>
<Preference
android:key="customPref"
android:title="Title Here"
android:summary="Summary Here"/>
</PreferenceScreen>
Run Code Online (Sandbox Code Playgroud)
所有这一切工作正常,但我的应用程序我有自定义背景和文本颜色/大小但我无法弄清楚如何格式化PreferenceScreen我假设你指向另一个xml?但无法弄清楚我需要的代码以及应该做出哪些改变.主要关注的是背景颜色文本很好我猜,但背景只是与我的应用程序的其余部分不匹配.所以我想设置一个自定义背景颜色,现在说红色(#ff0000)
我感谢任何可以帮助我解决这个问题的人
rau*_*aug 14
您可以申请一个theme
它在你的manifest
,例如
<activity android:name=".Settings"
android:theme="@style/YourStyle"/>
Run Code Online (Sandbox Code Playgroud)
在你的styles.xml
(如果你没有,在values文件夹中创建它)你可以修改你需要的任何东西
例如
<?xml version="1.0" encoding="utf-8"?>
<resources>
<style name="YourStyle" parent="android:Theme.Light">
<item name="android:listViewStyle">@style/Widget.ListView</item>
<item name="android:windowNoTitle">true</item>
</style>
<style name="Widget" parent="android:Widget">
</style>
<style name="Widget.ListView">
<item name="android:background">@color/white</item>
<item name="android:divider">@color/gray_division</item>
<item name="android:dividerHeight">2dip</item>
</style>
</resources>
Run Code Online (Sandbox Code Playgroud)
我希望这有帮助
归档时间: |
|
查看次数: |
8426 次 |
最近记录: |