I want to change default image of a ListPreference
by creating a new style
.
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
.
You can add an icon in the preference using the WidgetLayout property.
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
<?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" />
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With