【发布时间】:2021-03-05 17:15:04
【问题描述】:
我有一个布局,我想在其中显示一组编辑文本和一个日期选择器。由于我想对所有字段进行相同的设计,我发现我也需要为日期选择器使用编辑文本,但使其不可编辑但可点击。下面是我的编辑文本的 xml 代码,用于显示日期选择器:
<com.google.android.material.textfield.TextInputLayout
android:id="@+id/notification_layout"
style="@style/Theme.Connect.InputFieldLayout"
android:layout_width="match_parent"
android:layout_height="wrap_content"
app:startIconDrawable="@drawable/ic_stk_notification_24dp">
<com.google.android.material.textfield.TextInputEditText
android:id="@+id/notification_edit_text"
style="@style/Theme.Connect.InputField"
android:layout_width="match_parent"
android:layout_height="wrap_content"
android:hint="Notification"
android:maxLines="1"
android:lines="1"
android:cursorVisible="false"/>
</com.google.android.material.textfield.TextInputLayout>
我尝试了许多在互联网上找到的解决方案,我确实设法使编辑文本不可编辑,但没有波纹点击效果。有没有办法使编辑文本不可编辑但仍保持波纹点击效果?这是显示包含表单布局设计的日期选择器的最佳做法吗?
【问题讨论】:
标签: android layout material-ui material-components-android