I would like to know how I can prevent the control from EditText
displaying the keyboard every time it receives focus or the user hovers over the control.
The reason for this is that I want to use said control to show a calendar dialog every time it receives the focus or the user hovers over the control, so that the control will get the value of the date (I already have this last part implemented ).
In principle, according to the Android documentationandroid:inputType="none"
, setting the field's type attribute EditText
makes the text non-editable, so the expected behavior is that the android keyboard is not displayed . However, the keyboard still appears each time the control receives focus or the user clicks on the control.
Here is the xml code to define the control:
<android.support.design.widget.CoordinatorLayout xmlns:android="http://schemas.android.com/apk/res/android"
android:layout_width="match_parent"
android:layout_height="match_parent"
android:paddingLeft="16dp"
android:paddingRight="16dp">
<android.support.v4.widget.NestedScrollView
android:layout_width="match_parent"
android:layout_height="wrap_content">
<!-- Controles -->
<android.support.design.widget.TextInputLayout
android:id="@+id/tiFechaCaducidad"
android:layout_width="match_parent"
android:layout_height="wrap_content">
<EditText
android:id="@+id/etFechaCaducidad"
android:layout_width="match_parent"
android:layout_height="wrap_content"
android:hint="@string/fechacaducidad"
android:singleLine="true"
android:inputType="none"
android:drawableRight="@drawable/ic_arrow_drop_down" />
</android.support.design.widget.TextInputLayout>
</android.support.v4.widget.NestedScrollView>
</android.support.design.widget.CoordinatorLayout>
You can try to use this, hope it helps. I was going to put it as a comment but it was too long:
this is a method of the TextView:
This would be a way to do it, consuming the event
onTouch()
:Place the following in the properties of the edit text :
The answer to your question would be to assign the type
null
to the input of yourEditText
When entering the parameter
null
, the parameter that receives the text and automatically sends the android keyboard would be deactivated, being subject only to the text input that you handle through the code on the screen.