EditText TimePicker 显示 KeyBoard

EditText TimePicker shows KeyBoard

我有一个 EditText,它应该打开一个 TimePicker,但它没有打开键盘,一旦我用箭头移开键盘,返回,下一次按下就会显示 TimePicker。

如何让TimePicker在没有键盘的情况下直接显示?

我把xml留在这里:

<com.google.android.material.textfield.TextInputLayout
            style="@style/TextInputLayout"
            android:layout_width="match_parent"
            android:layout_height="wrap_content"
            android:hint="@string/fInicio">

            <com.google.android.material.textfield.TextInputEditText
                android:id="@+id/fIni"
                android:layout_width="match_parent"
                android:layout_height="wrap_content"
                android:maxLines="1"
                android:textColor="@color/colorAccent" />
        </com.google.android.material.textfield.TextInputLayout>

和Java代码:

 fIni.setOnClickListener(new View.OnClickListener() {

            @Override
            public void onClick(View v) {
                int anno = calendario.get(Calendar.YEAR);
                int mes = calendario.get(Calendar.MONTH);
                int dia = calendario.get(Calendar.DAY_OF_MONTH);

                final DatePickerDialog.OnDateSetListener date = new DatePickerDialog.OnDateSetListener() {
                    @Override
                    public void onDateSet(DatePicker datePicker, int year, int monthOfYear, int dayOfMonth) {
                        calendario.set(Calendar.YEAR, year);
                        calendario.set(Calendar.MONTH, monthOfYear);
                        calendario.set(Calendar.DAY_OF_MONTH, dayOfMonth);
                        fechaInicio = String.format("%02d/%02d/%04d", dayOfMonth,monthOfYear,year);
                        fIni.setText(fechaInicio);

                        if (!fechaFin.equals(""))
                        {
                            if (testChar(fFin.toString()))
                            {
                                Date fI = ParseFecha(fechaInicio);
                                Date fF = ParseFecha(fechaFin);

                                d=restarFechas(fI,fF);

                                dias.setText(String.valueOf(d));
                            }
                        }


                    }
                };
                new DatePickerDialog(NueAvaCuando.this, date, anno,mes,dia).show();
            }
        });

将此添加到 EditText

android:cursorVisible="false"
android:focusable="false"
android:inputType="none"

像那样:


            <com.google.android.material.textfield.TextInputEditText
                android:id="@+id/fIni"
                android:layout_width="match_parent"
                android:layout_height="wrap_content"
                android:cursorVisible="false"
                android:focusable="false"
                android:inputType="none"
                android:maxLines="1"
                android:textColor="@color/colorAccent" />