gpt4 book ai didi

Android 首选项 : Unlimited, 可扩展值列表

转载 作者:太空狗 更新时间:2023-10-29 12:58:35 25 4
gpt4 key购买 nike

我想允许用户为 Android 应用程序首选项输入(非预定数量的)值。想到的现有示例是各种智能手机(iPhone、HTC Android 等)上的闹钟应用程序,用户可以在其中添加闹钟时间。*

谁能想出一种简单的方法来向 Android 用户展示可扩展的可编辑偏好值列表?

到目前为止我想到的是:

  • 简单文本字段中的逗号分隔值。
  • 将用户限制为 10 个值,并将它们实现为 10 个可编辑的首选项 (EditTextPreference)。
  • 为这些设置制作我自己的精美子应用程序(虽然我还不确定我会怎么做)。

还有其他想法吗?

克里斯

*(与警报示例类似的其他可有可无的功能包括:按值/时间自动排序、激活/停用某些值的方法、用于选择类似于时间和日期选择轮的数值的轮在 iPhone 或 Android 上)。

最佳答案

I would like to allow the user to enter (a non-predetermined amount of) values for an Android application preference.

为什么偏好?为什么不使用关系数据库或您自己的平面文件结构(例如 JSON、CSV)?

Existing examples that come to mind are the alarm clock applications found on various smartphones (iPhone, HTC Android, ...) where the user can add an alarm clock time.*

您有什么证据表明他们使用偏好?例如,闹钟应用程序不使用 PreferenceActivity

Can anyone think of a simple way to present an Android user with an extensible list of editable preference values?

使用 ListView,通过选项菜单选项添加项目。点击一个项目会打开该项目的编辑器,允许更新(并通过选项菜单选择,删除)。毕竟,这就是闹钟应用程序所做的。

automatic ordering by value/time

训练您的 ListAdapter 进行排序。

a way to activate/deactivate certain values

CHOICE_MODE_MULTIPLE 使用 ListViewCheckedTextView。或者管理您自己的复选框(闹钟应用程序的方式)。

a wheel for selecting numeric values similar to time and date selection wheels on the iPhone or Android

Android 中没有“时间和日期选择轮”。有时间和日期选择器,它们使用按钮而不是滚轮。

您可以查看 source code of the alarm clock application详细了解它的工作原理。

关于Android 首选项 : Unlimited, 可扩展值列表,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/3175309/

25 4 0
Copyright 2021 - 2024 cfsdn All Rights Reserved 蜀ICP备2022000587号
广告合作:1813099741@qq.com 6ren.com