簡體   English   中英

更改ListPreference樣式

[英]Change ListPreference style

我想通過創建一個新style來更改ListPreference的默認圖像。

我通過繼承Widget.CompoundButton.CheckBox並設置一個新的android:buttonCheckBoxPreference Widget.CompoundButton.CheckBox了,但我不知道如何在ListPreference上做到這ListPreference

您可以使用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"
     />

和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.

 
粵ICP備18138465號  © 2020-2024 STACKOOM.COM