HOWTO进行类似于那些在设置布局 [英] Howto make a layout similar to the ones in settings

查看:71
本文介绍了HOWTO进行类似于那些在设置布局的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我有一个机器人的活动,我需要让用户输入一些信息。该数据适合于有点像preferenceView使用列表preferance元素。我相信,我可以使用preferences接口来获得我所需要的,但它会通过cludgy。有没有办法让这些小部件一样在普通视图?

I have an android Activity where I need to have the user enter some information. The data lends itself to something like a PreferenceView with ListPreferance elements. I am sure that I could use the preferences interfaces to get what I need, but it would by cludgy. Is there a way to get these same widgets in a regular view?

推荐答案

我最近按照类似的方法列出的<解决了这个相同的问题一个href="https://github.com/connectbot/connectbot/blob/master/src/org/connectbot/HostEditorActivity.java"相对=nofollow>此处。沸腾,而不是默认的共享preferences下降到提供preference XML到你的preferenceActivity,然后用自己的模型支持它。在这个例子中,他使用一个数据库,但如果你没有后备数据库(或者你不想犯每当设置改变),你可以使用地图为后盾编辑器。

I recently solved this same issue by following a similar approach to the one listed here. It boils down to providing a preference XML to your PreferenceActivity and then backing it with your own Model, instead of the default sharedPreferences. In the example he uses a database but if you don't have a backing database (or you don't want to commit whenever a setting is changed) you can use a Map for backing the Editor.

这篇关于HOWTO进行类似于那些在设置布局的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

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