To disable an EditText while keeping this properties, just use UI. setReadOnly(myEditText, true) from this library. If you want to replicate this behaviour without the library, check out the source code for this small method.
It returns CharSequence whose contents may be empty. CharSequence is an object reference to some class that implements the interface.
Set the Text of Android EditText In android, we can set the text of EditText control either while declaring it in Layout file or by using setText() method in Activity file. Following is the example to set the text of TextView control while declaring it in XML Layout file.
Hi I just want to know if it is possible to forbid the first number that the user can enter to be "0".
<EditText
android:id="@+id/editText1"
android:layout_width="50dp"
android:layout_height="35dp"
android:layout_marginBottom="2dp"
android:maxLength="2"
android:inputType="number"
android:digits="123456789">
<requestFocus />
</EditText>
Using this code however prevents the user from entering "0" at all but I want just the first digit not to be "0"
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With