显示自定义对话框时,微调被点击 [英] Show custom dialog when spinner is being clicked

查看:566
本文介绍了显示自定义对话框时,微调被点击的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

目前,我在对话框中的微调模式。

        <Spinner
            android:spinnerMode="dialog"
            android:id="@+id/genderSpinner"
            android:layout_width="match_parent"
            android:layout_height="wrap_content"
            android:layout_marginBottom="10dp"
            android:entries="@array/gender_array"
            android:prompt="@string/gender_prompt" />

它会显示这样的事情

It will show something like this

不过,有时候,我会想有什么类型的对话框中显示的控制。举例来说,我会想,以显示与日期选取器对话框,当微调是被点击了。

However, sometimes, I will like to have control on what type of dialog to be shown. For instance, I will like to show a dialog with date picker, when spinner is being clicked.

请注意,谷歌日历确实有这样的控制。

Note, Google Calendar does have such controls.

我想知道我怎样才能实现呢?

May I know how can I achieve so?

推荐答案

不要使用微调,但使用的TextView,并安装一个点击监听到它。

Do not use Spinner, but using TextView, and install a click listener to it.

为了把TextView的样子微调,这里是技术

In order to turn TextView looks like Spinner, here is the technique

        <TextView
            android:id="@+id/date"
            android:layout_width="0dp"
            android:layout_height="wrap_content"
            android:layout_weight="0.72"
            android:text="Aug 20, 2012"
            style="@android:style/Widget.Holo.Light.Spinner" />

        <TextView
            android:id="@+id/date"
            android:layout_width="0dp"
            android:layout_height="wrap_content"
            android:layout_weight="0.72"
            android:text="Aug 20, 2012"
            style="@android:style/Widget.Holo.Spinner" />

这篇关于显示自定义对话框时,微调被点击的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

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