<PreferenceScreen xmlns:android="http://schemas.android.com/apk/res/android">
<PreferenceCategory
android:title="First Category"
android:textSize="20px">
<CheckBoxPreference
android:title="Checkbox Preference"
android:defaultValue="false"
android:summary="This preference can be true or false"
android:key="checkboxPref" />
</PreferenceCategory>
</PreferenceScreen>
Run Code Online (Sandbox Code Playgroud)
我需要改变android:title的字体大小PrefereceCategory,CheckboxPreference和android:summary大小.这些标签没有任何android:textSize属性.任何人都可以帮我解决这个问题吗?
我无法自定义我的复选框,虽然我已在xml首选项文件中定义了背景,但它不会拉取文件.1.我试图显示复选框的自定义图像,并将选择器xml定义为"android_button.xml",如下所示:
<?xml version="1.0" encoding="utf-8"?>
<selector xmlns:android="http://schemas.android.com/apk/res/android">
<item android:state_checkable="true"
android:drawable="@drawable/state_normal" /> <!-- pressed -->
<item android:state_checked="true"
android:drawable="@drawable/android_pressed" /> <!-- focused -->
<item android:drawable="@drawable/state_normal" /> <!-- default -->
</selector>
Run Code Online (Sandbox Code Playgroud)
state_normal和android_pressed是res> drawable文件夹中的两个.png图像.
2.my Checkbox preference.xml文件是:
<CheckBoxPreference android:key="@string/Drop_Option"
android:title="Close after call drop"
android:defaultValue="true"
android:background="@drawable/android_button"
/>
Run Code Online (Sandbox Code Playgroud)
定义中是否有任何错误,屏幕上显示的唯一更改是android:title文本,如果我更改文本,则会更改文本.没有别的变化.我该如何解决.谢谢你的建议.
我PreferencesActivity需要它才能正确对齐,因为我想使用阿拉伯语,我试图使用它android:layout_gravity="right",PreferenceScreen但它没有用.
这是我的XML:
<PreferenceScreen xmlns:android="http://schemas.android.com/apk/res/android" android:layout_gravity="right">
<PreferenceCategory android:title="General Settings">
<CheckBoxPreference
android:title="Full Screen"
android:defaultValue="false"
android:summary="Always view as Full Screen"
android:key="fullScreenPref" />
<Preference
android:title="Report Bugs"
android:summary="Notify us for any Bugs or Errors"
android:key="bugs"/>
<Preference
android:title="About"
android:summary="Version 1.0.0"
android:key="about"/>
</PreferenceCategory>
</PreferenceScreen>
Run Code Online (Sandbox Code Playgroud)
这就是我在内部使用XML的方式PreferencesActivity:
addPreferencesFromResource(R.layout.preferences);
Run Code Online (Sandbox Code Playgroud)