Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

How to make an Edittext not clickable

I want to make an Editext only focus when I programmably tell it to and not allow the user to press on the one he wants. Is this possible?

I tried

android:longClickable="false"
android:clickable="false"

But neither worked.

For some reason people are thinking the following solves my problem, but that person is trying to make an edit text not editable, where I am trying to make an edit text only not focusable by clicking

EditText not editable

like image 792
Adam Katz Avatar asked Dec 18 '22 10:12

Adam Katz


2 Answers

Try with

    android:focusable="false"
    android:focusableInTouchMode="false"
like image 125
IntelliJ Amiya Avatar answered Jan 05 '23 00:01

IntelliJ Amiya


I ran into the same issue and solved it by using:

.setEnabled(false) and .setClickable(false)

so use this for your code:

.setEnabled(false);
.setClickable(false);
like image 43
jmckie Avatar answered Jan 04 '23 22:01

jmckie