如何禁用DatePickerDialog上的editText视图?

时间:2018-05-15 07:22:11

标签: android datepickerdialog

我想在主题设置为theme_traditional

时禁用var tls = { key: FS.readFileSync("...."), cert: FS.readFileSync("...") }; 上的EditText行为

enter image description here

DatePickerDialog

1 个答案:

答案 0 :(得分:0)

我已经使用AlertDialog进行了演示并且工作正常。没有更多可聚焦的孩子。

AlertDialog.Builder builder = new AlertDialog.Builder(DemoActivity.this);
            View view=LayoutInflater.from(DemoActivity.this).inflate(R.layout.temp,null);
            builder.setView(view);
            builder.setTitle("Pick");
            DatePicker datePicker=view.findViewById(R.id.dp);
            datePicker.setDescendantFocusability(ViewGroup.FOCUS_BLOCK_DESCENDANTS);
            builder.setPositiveButton("Set", (dialog, which) -> {

            });
            builder.setNegativeButton("Cancel", (dialog, which) -> {

            });
            AlertDialog dialog = builder.create();
            dialog.show();

xml是

<LinearLayout xmlns:android="http://schemas.android.com/apk/res/android"
android:id="@+id/linearLayout"
android:layout_width="match_parent"
android:layout_height="match_parent">
<DatePicker
    android:id="@+id/dp"
    android:layout_width="match_parent"
    android:calendarViewShown="false"
    android:datePickerMode="spinner"
    android:layout_height="wrap_content">
</DatePicker>

好吧,我无法在Gingerbread上测试(无法及时前往过去)。所以它在Android Oreo上测试过。看看这是否在Gingerbread上按预期工作。