Tag: android-edittext

AppCompat and EditText different underline on different API

I’m trying to make underline line color change for EditText (it will be used for input’s validation, so it must be able to change in runtime). I’m using AppCompat library. The problem is that on API 21 and above, I see transparent black line (gray overlay), instead of bolded version. How to make it the […]

EditText getHint() returns null when using design support library

When using EditText in combination with Design lib’s (ver 22.2.1) TextInputLayout getting hint programmatically returns null. I’m trying to append asterisk ‘*’ to a mandatory field programmatically, hence EditText.getHint() but the fact that it returns null is an issue in this case. EditText editText = (EditText) findViewById(R.id.edit2); String hint = String.format(“%s *”, editText.getHint()); editText.setHint(hint); A […]

android format edittext to display spaces after every 4 characters

Android – I want to get a number input from the user into an EditText – it needs to be separated by spaces – every 4 characters. Example: 123456781234 -> 1234 5678 1234 This is only for visual purpose. However i need the string without spaces for further usage. What is the easiest way I […]

Prevent drag drop of custom mimetype to EditText

I have a custom mime type which I am intending to use to drag and drop application objects within the app. This seems to be working but I’m finding that the EditText fields are also accepting the drop action. I don’t want this to happen. First, I’ve defined the custome mime type like this: public […]

How can I make my EditText five lines high without using android:inputType=“textMultiLine”?

I want to have a EditText view that is five lines high. I want it five lines high for visual appeal reasons only (so that it does not appear cramped). The code below does not work, the EditText appears only one line high. I have tried multilinetext and it works visually, however I want to […]

How to put Editable edittext within a listview?

I use section adapter for the whole listview.Now in this image,there is a edittext which is not editable.I want to make this edittext editable.

Android – How to only allow a certain number of decimal places

Do you know of any method to make sure users can only enter figures with a maximum number of decimals. I’m not sure how to address this problem. In the MS SQL database I’m going to send data from my app I’ve got columns with this type decimal(8,3) Now considering the data type of the […]

How to format the input of EditText when typing with thousands separators (,) in Android?

I’ve an edittext , it only gets numeric without decimal numbers. android:inputType=”number” I want to separate thousands while I’m typing . For example 25,000 . I know I should use TextWatcher and I’ve used this code but I couldn’t make it work : @Override public void afterTextChanged(Editable viewss) { String s = null; try { […]

How to remove EditText drawable padding?

I wasted the last hour trying to figure out how to get rid of this padding in a simple EditText: All I want is to align the input with the rest of the content, just like the beautiful design guide says. The layout couldn’t be simpler: <ScrollView xmlns:android=”http://schemas.android.com/apk/res/android” xmlns:tools=”http://schemas.android.com/tools” android:layout_width=”match_parent” android:layout_height=”match_parent” tools:context=”com.actinarium.tiomantas.SetupChallengeFragment”> <LinearLayout android:layout_width=”match_parent” android:layout_height=”wrap_content” […]

requestFocus skipping next EditText

I’m having some problems with the control focusing. My interface definition below has: source (RadioGroup/optional) destination (EditText) quantity (EditText) transfer (Button) I’m changing the visibility of the “source” into my code. When the times I don’t display it, focus is automatically goes to “quantity” which I would expect that to be “destination” instead. I don’t […]

Android Babe is a Google Android Fan, All about Android Phones, Android Wear, Android Dev and Android Games Apps and so on.