首页
学习
活动
专区
圈层
工具
发布
首页
学习
活动
专区
圈层
工具
MCP广场
社区首页 >问答首页 >更改ListPreference样式

更改ListPreference样式
EN

Stack Overflow用户
提问于 2012-07-25 22:08:01
回答 1查看 1.5K关注 0票数 5

我想通过创建新的style来更改ListPreference的默认图像。

我通过继承CheckBoxPreference并设置了一个新的android:button来实现它,但是我不知道如何在ListPreference上实现它。

EN

回答 1

Stack Overflow用户

发布于 2012-08-07 19:38:22

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

示例:

代码语言:javascript
复制
<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

代码语言:javascript
复制
<?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" />
票数 1
EN
页面原文内容由Stack Overflow提供。腾讯云小微IT领域专用引擎提供翻译支持
原文链接:

https://stackoverflow.com/questions/11651650

复制
相关文章

相似问题

领券
问题归档专栏文章快讯文章归档关键词归档开发者手册归档开发者手册 Section 归档