目前,我在对话框中的微调
模式。
<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" />