【发布时间】:2019-08-13 09:03:27
【问题描述】:
我有使用TextInputEditText 和TextInputLayout 的特殊布局。它的形式类似于布局,但一个View 从外观上看只有TextInputEditText。它不会有任何可编辑的部分。它的目的是提供信息并像Button 一样行事。还有一个问题。我将这个EditText 包裹在FrameLayout 中,FrameLayout 就像Button 一样有onClickListener。问题是它对点击没有反应。如何启用它? (就可点击区域而言,FrameLayout 应该在其子项的前面)
<FrameLayout
android:id="@+id/updateButton"
android:layout_width="match_parent"
android:layout_height="wrap_content"
android:clickable="true"
android:focusable="true">
<com.google.android.material.textfield.TextInputLayout
android:id="@+id/etLayout"
android:layout_width="match_parent"
android:layout_height="wrap_content"
style="@style/form_edit_text_style"
app:errorEnabled="true"
android:clickable="false"
android:focusable="false"
android:hint="@string/et_hint_num">
<com.google.android.material.textfield.TextInputEditText
android:id="@+id/etField"
android:layout_width="match_parent"
android:inputType="text"
android:enabled="false"
android:clickable="false"
android:focusable="false"
style="@style/form_inner_style"/>
</com.google.android.material.textfield.TextInputLayout>
</FrameLayout>
【问题讨论】:
标签: android android-layout android-edittext android-textinputlayout