Android Studio 3.1布局编辑器中的TimePicker在哪里

问题描述:

在升级到Android Studio 3.1时,布局编辑器面板中没有TimePicker。

搜索找不到它。

实际上,所有选择器控件似乎都具有消失了。
他们在3.0版本中。

On upgrade to Android Studio 3.1 there is no TimePicker in the layout editor palette.
Search doesn't find it.
In fact all of the picker controls seem to have vanished. They were there in 3.0.

我不确定在选择菜单中的哪里可以找到它,但是如果您只需要在项目中使用时间选择器,则可以选择 activity.xml 文件底部的 Text 标签,然后粘贴TimePicker xml。

I am not sure where to find it in the selection menu but if you just need a time picker in your project you can select the Text tab on the bottom of your activity.xml file and paste the TimePicker xml.

<TimePicker
android:id="@+id/simpleTimePicker"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:timePickerMode="spinner"/>

然后,您可以选择所需的 timePickerMode 如果您想要一个时钟,则将 spinner 更改为 clock

Then you can select which timePickerMode you want if you want a clock then change spinner with clock.

希望这会有所帮助。