如何弹出列表中不一样飞旋在Android的一个微调? [英] How to popup list like a spinner without spinner in android?

查看:127
本文介绍了如何弹出列表中不一样飞旋在Android的一个微调?的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我在活动一微调控件,它可以让用户选择一个列表名称。

I have a spinner widget in my activity which lets users pick a list name.

通常情况下,微调的作用是列表之间,但一对夫妇的实例进行切换,我换出的选择改变监听器与选择相同的列表执行不同的功能。一旦选择完毕,旧的监听被恢复,生活还要继续。

Normally, the function of the spinner is to switch between lists but for a couple of instances, I swap out the selection change listener to perform a different function with the same list of options. Once the selection has been made, the old listener is restored and life goes on.

这是一个坏的和马车的安排。相反,我想有一个函数,只是需要选择监听器和其他一些参数,并显示这些受​​相同的游标填充(或和相同的光标)作为微调弹出列表,而无需使用微调本身。

This is a bad and buggy arrangement. Instead, I would like to have a function that just takes a selection listener and some other parameters and shows a popup list that's populated by the same cursor (or and identical cursor) as the spinner, without using the spinner itself.

有没有什么办法可以做到这一点?

Is there any way I can do this?

推荐答案

使用 AlertDialog.Builder 并提供一个适配器通过 setAdapter()生成的行。

Use AlertDialog.Builder and supply an Adapter via setAdapter() that generates your rows.

在你的情况,我也不会使用相同的光标,作为光标具有的固有的观念当前行,并用光标,搞乱,而它是由您的 SpinnerAdapter 可能搞砸了微调。去用相同的光标

In your case, I would not use the same Cursor, as a Cursor has an intrinsic notion of the current row, and so messing with the Cursor while it is used by your SpinnerAdapter could screw up the Spinner. Go with an identical Cursor.

这篇关于如何弹出列表中不一样飞旋在Android的一个微调?的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

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