Предотвратить EditText от потребления касаний на нем - PullRequest
0 голосов
/ 21 марта 2019

Я хочу запретить EditText получать сенсорные события, чтобы показать эффект ряби позади него. Вот пример кода: есть ли способ сделать это?

    <?xml version="1.0" encoding="utf-8"?>
<layout xmlns:android="http://schemas.android.com/apk/res/android"
    xmlns:tools="http://schemas.android.com/tools"
    xmlns:app="http://schemas.android.com/apk/res-auto">

        <RelativeLayout
        android:layout_width="match_parent"
        android:layout_height="wrap_content"
        android:layout_marginStart="16dp"
        android:layout_marginTop="8dp"
        android:layout_marginEnd="16dp"
        android:layout_marginBottom="8dp"
        android:clickable="true"
        android:focusable="true"
        android:foreground="?attr/selectableItemBackground">

            <com.google.android.material.textfield.TextInputLayout
                android:layout_width="match_parent"
                android:layout_height="wrap_content"
                android:layout_alignParentStart="true"
                android:layout_centerVertical="true"
                android:hint="Hint"
                android:paddingStart="16dp"
                android:paddingTop="24dp"
                android:paddingEnd="16dp"
                android:paddingBottomenter code here="24dp">

                <EditText
                    android:id="@+id/field"
                    android:layout_width="match_parent"
                    android:layout_height="wrap_content"
                    android:background="@android:color/transparent"
                    android:clickable="false"
                    android:focusable="false"
                    android:inputType="none
                    tools:ignore="Autofill,LabelFor,TextFields" />
            </com.google.android.material.textfield.TextInputLayout>
        </RelativeLayout>
</layout>

1 Ответ

0 голосов
/ 21 марта 2019

Вы можете попытаться добавить в свой XML-файл следующие элементы:

android:enabled="false"

Это то, что вы имеете в виду под эффектом ряби?

...