I would like to have an EditText that is disabled for user input but the user can click on it to open dialog.
So I did the following:
<EditText android:id="@+id/select" android:layout_width="match_parent"
android:layout_height="wrap_content" android:hint="Click here"
android:maxLines="1"
android:editable="false" android:clickable="true"
android:singleLine="true" android:layout_marginTop="16dp"
android:onClick="openDialog"
android:enabled="true" />
The onCreateView
method is:
@Override
public View onCreateView(LayoutInflater inflater, ViewGroup container, Bundle savedInstanceState) {
View view = inflater.inflate(R.layout.fragment_custom, container);
return view;
}
I'm using an EditText and not a TextView because I would like to show a hint the and line below the text.
It partially works, because when the edittext is not focused I have to click a second time on it for the dialog to open.
Is it possible to have it in such a way that the user needs to click only once on it to open the dialog?