[英]Change ListPreference style
I want to change default image of a ListPreference
by creating a new style
. 我想通过创建一个新
style
来更改ListPreference
的默认图像。
I did it with a CheckBoxPreference
by inherit Widget.CompoundButton.CheckBox
and setting a new android:button
, but I don't know how to do it on a ListPreference
. 我通过继承
Widget.CompoundButton.CheckBox
并设置一个新的android:button
用CheckBoxPreference
Widget.CompoundButton.CheckBox
了,但我不知道如何在ListPreference
上做到这ListPreference
。
You can add an icon in the preference using the WidgetLayout property. 您可以使用WidgetLayout属性在首选项中添加图标。
Example: 例:
<EditTextPreference
android:defaultValue=""
android:dialogTitle="@string/mode_name"
android:key="mode_name"
android:order="0"
android:summary=""
android:title="@string/mode_name"
android:widgetLayout="@layout/mode_item_preference"
/>
And the mode_item_preference.xml 和mode_item_preference.xml
<?xml version="1.0" encoding="utf-8"?>
<ImageView xmlns:android="http://schemas.android.com/apk/res/android"
android:id="@+id/imageView1"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:contentDescription="@string/app_name"
android:focusable="false"
android:src="@drawable/delete" />
声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.