安卓preferences微调 [英] Android preferences spinner

查看:161
本文介绍了安卓preferences微调的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

如何建立这样的事情?我想开在preferences活动,在这里用户可以更改号码与微调对话框,当他点击了根据preference项目。

How can I build something like this? I wanna open a dialog in the Preferences Activity, where the user can change the number with a spinner, when he clicks on the according preference item.

我从 Android开发工具的截图,但我不能找一些例如code。

I got the screenshot from Android Developer Tools, but I cannot find some example code.

推荐答案

我已经开发了一个自定义preference,它可以发现的这里

I have developed a Custom Preference, which can be found here.

XML code:

<com.vanniktech.vntnumberpickerpreference.VNTNumberPickerPreference
    android:defaultValue="@integer/font_size_default_value"
    android:key="preference_font_size"
    android:title="@string/font_size"
    speedreader:maxValue="@integer/font_size_max_value"
    speedreader:minValue="@integer/font_size_min_value" />

一些东西,其中有是在 RES /价值/ attrs.xml

<?xml version="1.0" encoding="utf-8"?>
<resources>

    <declare-styleable name="VNTNumberPickerPreference">
        <attr name="minValue" format="integer" />
        <attr name="maxValue" format="integer" />
    </declare-styleable>

</resources>

在VNTNumberPicker preference类可以找到<一href="https://github.com/vanniktech/VNTNumberPicker$p$pference/blob/master/src/com/vanniktech/vntnumberpicker$p$pference/VNTNumberPicker$p$pference.java"相对=nofollow>这里。

这篇关于安卓preferences微调的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆