Warning: file_get_contents(/data/phpspider/zhask/data//catemap/9/java/356.json): failed to open stream: No such file or directory in /data/phpspider/zhask/libs/function.php on line 167

Warning: Invalid argument supplied for foreach() in /data/phpspider/zhask/libs/tag.function.php on line 1116

Notice: Undefined index: in /data/phpspider/zhask/libs/function.php on line 180

Warning: array_chunk() expects parameter 1 to be array, null given in /data/phpspider/zhask/libs/function.php on line 181
Java Android Studio中的弹出日期(从不使用SelectDate方法)_Java_Android - Fatal编程技术网

Java Android Studio中的弹出日期(从不使用SelectDate方法)

Java Android Studio中的弹出日期(从不使用SelectDate方法),java,android,Java,Android,我试图弹出一个编辑文本来选择日期,然后存储在编辑文本中。我正在使用这个代码。但SelectDate方法是灰色的,上面写着:“从不使用SelectDate方法”。 我的代码: 和我的xml: <EditText android:id="@+id/mEdit" android:layout_width="wrap_content" android:layout_height="wrap_content" android:focus

我试图弹出一个编辑文本来选择日期,然后存储在编辑文本中。我正在使用这个代码。但SelectDate方法是灰色的,上面写着:“从不使用SelectDate方法”。 我的代码:

和我的xml:

<EditText
        android:id="@+id/mEdit"
        android:layout_width="wrap_content"
        android:layout_height="wrap_content"
        android:focusable="false"
        android:inputType="date"
        android:ems="10"
        android:hint="+ Add Date"
        android:onClick="selectDate" />


当我播放应用程序时,会显示编辑文本,但当我单击时,只显示键盘。有什么建议吗?

为什么要使用EditText?我认为你应该使用文本视图。因为需要可编辑和可更改的日期需要用键盘编辑?那么,为什么要显示对话框?我需要输入一个日期,如果我出错,我需要再次更改日期。不,不需要使用键盘进行编辑。
<EditText
        android:id="@+id/mEdit"
        android:layout_width="wrap_content"
        android:layout_height="wrap_content"
        android:focusable="false"
        android:inputType="date"
        android:ems="10"
        android:hint="+ Add Date"
        android:onClick="selectDate" />