Set inputType for an EditText Programmatically?
How do we set the input type for an EditText programatically? I’m trying: mEdit.setInputType(InputType.TYPE_TEXT_VARIATION_PASSWORD); it doesn’t seem to have any effect. 16 Answers 16
How do we set the input type for an EditText programatically? I’m trying: mEdit.setInputType(InputType.TYPE_TEXT_VARIATION_PASSWORD); it doesn’t seem to have any effect. 16 Answers 16
I have added an image right of the text in an EditText widget, using the following XML: <EditText android:id=”@+id/txtsearch” … android:layout_gravity=”center_vertical” android:background=”@layout/shape” android:hint=”Enter place,city,state” android:drawableRight=”@drawable/cross” /> But I want to clear the EditText when the embedded image is clicked. How can I do this? 41 Answers 41 Actually you don’t need to extend any class. … Read more
There are two EditText,while loading the page a text is set in the first EditText, So now cursor will be in the starting place of EditText, I want to set cursor position in the second EditText which contains no data. How to do this? 23 Answers 23
When an EditText is in password mode, it seems that the hint is shown in a different font (courrier?). How can I avoid this? I would like the hint to appear in the same font that when the EditText is not in password mode. My current xml: <EditText android:hint=”@string/edt_password_hint” android:layout_width=”fill_parent” android:layout_height=”wrap_content” android:password=”true” android:singleLine=”true” /> 18 … Read more
I have an EditText with some dummy text in it. When the user clicks on it I want it to be selected so that when the user starts typing the dummy text gets deleted. How can I achieve this? 11 Answers 11
In my project I have an EditText. I want to count the characters in the EditText, and show that number it in a TextView. I have written the following code and it works fine. However, my problem is when I click Backspace it counts up, but I need to decrement the number. How can I … Read more
Can anyone tell me how to make an EditText not editable via XML? I tried setting android:editable to false, but it is deprecated; and it didn’t work. 29 Answers 29
How to create an EditText that has rounded corners instead of the default rectangular-shaped corners? 8 Answers 8
I am using appcompat v7 to get the look consistent on Android 5 and less. It works rather well. However I cannot figure out how to change the bottom line color and the accent color for EditTexts. Is it possible? I have tried to define a custom android:editTextStyle (cf. below) but I only succeeded to … Read more
possible duplicate : android-singleline-true-not-working-for-edittext <EditText android:id=”@+id/searchbox” android:layout_width=”fill_parent” android:layout_height=”wrap_content” android:lines=”1″ android:scrollHorizontally=”true” android:ellipsize=”end” android:layout_weight=”1″ android:layout_marginTop=”2dp” android:drawablePadding=”10dp” android:background=”@drawable/edittext” android:drawableLeft=”@drawable/folder_full” android:drawableRight=”@drawable/search” android:paddingLeft=”15dp” android:hint=”search…”> </EditText> I want to make the above EditText to have only single line. Even if the user presses “enter” the cursor should not get down to the second line. Can anybody help me doing that? 24 … Read more