How to make edit text not editable but clickable in JAVA
The trick here is :-
et.setFocusable(false);
et.setClickable(true);
As editable
is deprecated. you can use android:inputType
as none in designing xml or as InputType.TYPE_NULL in coding.
Designing XML
<android.support.v7.widget.AppCompatEditText
android:id="@+id/edt"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:clickable="true"
android:focusable="false"
android:inputType="none"
android:text="EditText"/>
Coding
edt.setClickable(true);
edt.setFocusable(false);
edt.setInputType(InputType.TYPE_NULL);
And below is the click event of edittext
edt.setOnClickListener(new View.OnClickListener() {
@Override
public void onClick(View v) {
Toast.makeText(YourActivity.this,"edt click", Toast.LENGTH_LONG).show();
}
});