android-edittext

How to switch to numeric with special characters keyboard of EditText in Android by default

删除回忆录丶 提交于 2019-12-06 15:51:27
I want to show this keyboard by default on EditText focus: These actions didn't help: inputType=number inputTYpe=phone numeric=integer setRawInputType(...) How should I do it? Wishmaster That old problem still not solved. There's no way to show numeric keyboard with option of switching back. This question discussed here Is there a way to show the numbers first on the soft keyboard for Android? johnrao07 try to use this in java: editText.setInputType(InputType.TYPE_CLASS_TEXT); editText.setRawInputType(InputType.TYPE_CLASS_NUMBER); There's no way to achieve this. Even if your input method

EditText with InputFilter assigned / Decimal separator hidden in landscape mode

北战南征 提交于 2019-12-06 15:48:05
I'm facing a very strange problem with an EditText with assigned InputFilter in an application I'm writing. The idea is, to have an EditText, which only accepts decimal numbers as input with a maximum of two decimal places and a decimal separator according to the user's locale settings. Here are the relevant pieces of code The EditText in my layout <EditText android:id="@+id/value" android:layout_width="match_parent" android:layout_height="wrap_content" android:digits="01234567890,." android:inputType="number|numberDecimal" android:nextFocusForward="@+id/category" > The InputFilter

Multiple hints or multiple style for the same hint in edittext

两盒软妹~` 提交于 2019-12-06 14:49:45
How to add to an EditText component another hint that will react as an hint, but with different as the default hint. For example: field name is city, so I would like the primary hint in black to be displayed as "city" and in light blue I would like it to be dislayed as "tap to select a city". Are there any ready-to-go components or xml attributes for it? Is this a case where I need Java code and implement onfocus and show/hide another TextView that will react as label? I got this as strings.xml: <string name="fld_fullname"> <![CDATA[ <font color="#8B8B8B">City</font> <font color="#BABABA">tap

how to retrieve value from all EditText in ListView

时光总嘲笑我的痴心妄想 提交于 2019-12-06 14:47:30
问题 i have a structure like this in my ListView TextView EditText TextView EditText TextView EditText Btton when i click on ok button. how to retrieve value from each EditText and print Sum of it on dialog box...any idea....? 回答1: Assuming your row layout is something like LinearLayout - TextView - Edittext You can use something like for(int i =0;i<getListView.getChildCount();i++){ LinearLayout layout = getListView.getChildAt(i); String text = layout.getChildAt(1).getText(); } 回答2: I would do it

how can i underline each character in edittext?

不问归期 提交于 2019-12-06 14:04:51
I'm trying to write a word guessing game like hangman in android. let's say if the word is 'apple'. I want to display 5 underlines to tell the player that the word is 5 chars long, and they should be displayed/filled like below i cant think of a way to do so easily. i found this to be exact the same what Im looking for but there's no answer given and somehow got a lot of downvotes. my initial thought is creating edittext with underline to be the hint and loop through all the characters. this will create # of edittext based on how many characters, but underline will be gone once a char is

Continuously delete contents of EditText on button hold Android [duplicate]

荒凉一梦 提交于 2019-12-06 13:46:35
问题 This question already has an answer here : Send backspace key event to edit text (1 answer) Closed 5 years ago . How do I delete one by one the current text of edit text when I press a button and continuously delete the text one by one when I hold the press of button. Similar to what a backspace button does. Sending a backspace event won't work on my needs because it will only work if the keyboard is active. Im not using any keyboards. 回答1: You have to use the Timer for this.It continuously

setSpan() on EditText deletes other spans

倾然丶 夕夏残阳落幕 提交于 2019-12-06 13:26:13
I have a bold button that, when pressed, is supposed to change the typeface of the selected text in the EditText field . This all works perfectly, with one exception. If there is bold typeface elsewhere in the EditText , and I try to create a new bold section, the original section is changed back to normal . For example, this string: Bold not bold more bold. If I highlight any of the normal words and press the button, they do become bold , but the first word becomes normal . I can't see any reason for this in my code. Thanks! final StyleSpan normalStyle = new StyleSpan(Typeface.NORMAL); final

Show password characters for a short while before hiding them

一个人想着一个人 提交于 2019-12-06 12:04:39
In my application I've implemented a num-pad of my own, which is used for entering (number-based) passcodes. The 'password', or rather the 'dot'-representation of it, is shown on 4 EditTexts implemented in 4 boxes above the num-pad. When you enter a number one of those boxes will get filled in with a dot - for this I use the TransformationMethod PasswordTransformationMethod - but I'd want the number you punch in to be visible for a short while before it gets hidden (Like ~200ms). Is there any implementation of this readily-done in Android or how would you implement this the best way? I'm sure

Asus Zenfone (Android) TextView\\TextWatcher keyboard input bug

给你一囗甜甜゛ 提交于 2019-12-06 12:02:19
Update: actually, this is not a problem with Asus Phones, it's a problem with Asus ZenUI's keyboard. You can install a keyboard you like to walk around the problem. I have tested Zenfone 2 with Google Keyboard installed. Everything in my TextWatcher works fine. But it is not a bug fix or problem solution. I have two InputFilter s and one TextWatcher attached to my EditText . InputFilters : standard InputFilter.AllCaps() filter and custom 'alphabet characetrs only'. They works as magic. TextWatcher makes some text transofrmations (transliterates symbols from Russian into English). TextWatcher

How to reposition cursor while editing EditText field which is formatted like US currency- Android

浪尽此生 提交于 2019-12-06 11:18:37
问题 I am formatting edit text field as per US currency format, where while typing number in a field, let's say "12345678" it appears like "12,345,678". For this I have used TextWatcher and on afterTextChanged(...) method I am formatting the entered text like: @Override public void afterTextChanged(Editable editable) { String str = editable.toString(); String number = str.replaceAll("[,]", ""); if (number.equals(previousNumber) || number.isEmpty()) { return; } previousNumber = number;