android-edittext

Set text color for a specific text in Android Edittext

99封情书 提交于 2019-12-11 00:48:28
问题 If user types a String and it contains @ i want to change the color of the text to red.i have tried with textwatcher but got stack overflow error.I want to change the color only if the @ is at the beginning.The code is given below topic.addTextChangedListener(new TextWatcher() { public void onTextChanged(CharSequence s, int start, int before, int count) { } public void beforeTextChanged(CharSequence s, int start, int count, int after) { } public void afterTextChanged(Editable s) { if (s

How to scroll an EditText to the very top of the layout?

百般思念 提交于 2019-12-11 00:47:06
问题 So I have this layout with some ChipsInput inside a scrollview and I simply want these to go to the very top when the keyboard is activated I've tried to change windowSoftInputMode to adjustPan and others but it does not make it to go to the very top, just doesn't cover it. Here's my xml layout <LinearLayout xmlns:android="http://schemas.android.com/apk/res/android" xmlns:app="http://schemas.android.com/apk/res-auto" xmlns:tools="http://schemas.android.com/tools" android:id="@+id

How can I apply the changes to the position of a view after an animation?

孤者浪人 提交于 2019-12-11 00:44:24
问题 I applyed a TranslateAnimation to an EditText with the FillAfter=true in order to keep its position at the end of the animation. The animation works properly but the problem is that I can't enter to the edittext anymore. I think it's due to the fact that the animation affects only the rendering without modifying the actual view coordinates. Is there any possibility to maintain the final coordinates with the edittext normally working? Thanks, Daniele 回答1: Unfotunately the animation only

Android EditText does not work, android:imeOptions=“actionNext” android:inputType=“phone”

£可爱£侵袭症+ 提交于 2019-12-10 23:35:25
问题 I have tried, and only if I delete android:inputType="phone" the keyboard Enter can jump to the Next EditText. I don't know whether there have been some conflicts between android:imeOptions="actionNext" and android:inputType="phone" . code : AutoCompleteTextView has android:imeOptions="actionNext" and android:inputType="phone" , but Enter on the keyboard will not go to the next one. <RelativeLayout android:layout_width="match_parent" android:layout_height="wrap_content" android:orientation=

Hide soft keyboard for editText focus/touch

孤人 提交于 2019-12-10 23:32:44
问题 I am trying to hide the soft keyboard from showing when an EditText either receives focus or a touch event. I want the EditText to be editable - there will be text in the EditText, so I want the EditText to respond to a touch event so the cursor is positioned, but I will have dedicated buttons for editing rather than using the soft keyboard. I can't get this to work - the soft keyboard seems to pop up on both focuschange and touch events. I have reduced the code to the following:

Forcing User to Input Something in EditText in Android

被刻印的时光 ゝ 提交于 2019-12-10 23:32:34
问题 I have several EditTexts in my Activty and I want my users to give inputs correctly before submitting the form. How can I do It? I have also spinners and RadioGroup Button. 回答1: You can add Validation on submit button click: private boolean validateFields() { int yourDesiredLength = 5; if (yourEditText1.getText().length() < yourDesiredLength) { yourEditText1.setError("Your Input is Invalid"); return false; }else if (yourEditText2.getText().length() < yourDesiredLength) { yourEditText1

How to setFocusable true after setting it to false?

橙三吉。 提交于 2019-12-10 23:32:17
问题 here is my code: mEditText.setOnKeyListener(new View.OnKeyListener() { @Override public boolean onKey(View view, int i, KeyEvent keyEvent) { mEditText.setFocusable(false); mEditText.setCursorVisible(false); } }); Now i want to enter some text into edittext.for which i have to setFocuable to true.i already tried to setFocusable(true) in onClick , setOnClickListener , setOnTouchListener but nothing is working...help me guys;(... 回答1: after searching for hours.i came up with solution- Xml Code:

Format edit text to take month and year

家住魔仙堡 提交于 2019-12-10 23:19:54
问题 I have a certain requirement to make a EditText in Android to take month and year(So I gave the hint as mm/yy). When user enters month compulsorily 2 digits, then a / should be visible, say(11/) followed by year. The following is the code that I have used on editext . However when I press the cross button on keypad of mobile it does not delete the / but deletes the month entered. Can somebody tell me why is this behaviour? ed.addTextChangedListener(new TextWatcher(){ @Override public void

android textInputEditText with custom background is not working ok

旧时模样 提交于 2019-12-10 23:03:13
问题 i'm using textInputEditText inside textInputLayout i had to set background for my editText to achieve a bordered view for my editText. but when i call setError() on my textInputLayout the entire editText color changes to red. but i want to change only the color of error text, not the entire view. before setting error : screen shot after setting error : screen shot and here is my xml code : <android.support.design.widget.TextInputLayout android:layout_alignParentTop="true" android:id="@+id/ex

Android multiline number edittext

三世轮回 提交于 2019-12-10 22:30:33
问题 I want to create an EditText in Android which has several lines and number input. It is for the input of a matrix. I already have a solution to set android:inputType="textMultiLine" and then setRawInputType(Configuration.KEYBOARD_12KEY) . However, this does not work when editing the edittext in horizontal orientation and it also does not show the slash ( / ) which I need to input fractions. If I set the input type to setRawInputType(InputType.TYPE_CLASS_NUMBER) , it also does not work in