更改ListPreference样式

SxE*_*dge 5 android android-widget android-layout android-theme

我想ListPreference通过创建一个新的更改a的默认图像style.

我是CheckBoxPreference通过继承Widget.CompoundButton.CheckBox并设置一个新的android:button,但我不知道如何在一个ListPreference.

Sig*_*ist 1

您可以使用 WidgetLayout 属性在首选项中添加图标。

例子:

<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"
     />
Run Code Online (Sandbox Code Playgroud)

和 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" />
Run Code Online (Sandbox Code Playgroud)