我要创建我的第一个Android应用(或试图反正)和我有一个问题,我似乎无法找到答案。
I'm creating my first android app (or attempting to anyway) and i have a question i can't seem to find the answer to.
我想允许用户输入一组独立的preferences为在列表视图中的每个项目。我有preferenceScreen工作,但它保持了相同preferences为每个项目(即改变1项结果改变所有其他人也)。
I would like to allow users to enter a separate set of preferences for each item in a list view. I have the PreferenceScreen working, but it maintains the same preferences for every item (i.e. changing 1 item results in changes to all others as well).
要给出一个更详细的例子:说我有车的列表:*汽车1* 2车*等等...
To give a more detailed example: Say i have a list of cars: * Car 1 * Car 2 * Etc...
我想是不是有在全球范围内存储的条目能够点击汽车1,并获得了preferencesScreen指定制作只是那车,示范单位,颜色,整个应用程序。
I would like to be able to click on "Car 1" and get a PreferencesScreen to specify "Make", "Model", "Color" for just that car, instead of having those entries stored globally for the whole app.
这可能吗?
感谢您的帮助!
//ñ
推荐答案解决它!
有关的任何疑惑,解决的办法是,你必须调用
For any wondering, the solution is that you must call
的get preferenceManager()。setShared preferenceName(值)独特的项目的值要修改preferences对(在我的情况,我用的ListView 位置)调用之前添加preferencesFromResource 。
getPreferenceManager().setSharedPreferenceName(value) with a value unique to the item you'd like to modify the preferences for (in my case, i used the ListView position) prior to calling addPreferencesFromResource.
更多推荐
个人preferences在一个ListView每个项目?
发布评论