android-edittext

Android - EditText gives IndexOutOfBounds Exception while using textAllCaps

亡梦爱人 提交于 2019-11-27 20:22:11
I'm trying to create a very simple registration page using a relative layout. This registration page is linked to a fragment called RegistrationFragment. I have five EditText fields for this layout: name, phone number, email, password, and confirm password. For some reason, I can enter text into password and confirm password, but whenever I try to enter any text into the other fields, they immediately crash the application with an IndexOutOfBounds Exception. Here's the full stack trace: java.lang.IndexOutOfBoundsException at android.graphics.Paint.getTextRunAdvances(Paint.java:1879) at android

Android edittext key return goes to next text

烂漫一生 提交于 2019-11-27 20:15:01
问题 I have a series of EditText entries and would like it so when the user hits the enter key it will go to the next Editext. I know how do this one at a time but is there a way to tell all of the edittext controls to use the same function that checks the key entry and advances the cursor. It seems kind of crazy to have one function for each of the EditTexts 回答1: Much simpler than sniffing keys: try setting android:singleLine="true" and android:imeOptions="actionNext" (at least for single-line

Change thickness of the bottom line of EditText when wrapped into TextInputLayout

懵懂的女人 提交于 2019-11-27 20:06:03
here is my code XML Markup <android.support.design.widget.TextInputLayout android:layout_width="match_parent" android:layout_height="wrap_content" android:theme="@style/TextLabel"> <EditText android:id="@+id/etContactName" android:layout_width="match_parent" android:layout_height="wrap_content" android:hint="Contact Name"/> </android.support.design.widget.TextInputLayout> Style <style name="TextLabel" parent="TextAppearance.AppCompat"> <item name="android:textColorHint">@color/hintColor</item> <item name="colorAccent">@color/primaryColor</item> <item name="colorControlNormal">@color/hintColor<

KeyCode_Enter to next edittext

送分小仙女□ 提交于 2019-11-27 20:05:18
In edittext, after typing 'Enter' key, system make a new line inside it. I'd like to focus on next edittext, no new line. how to code? my code in xml is below <EditText android:id="@+id/txtNPCode" android:layout_width="fill_parent" android:layout_height="wrap_content" android:textSize="18sp" android:layout_alignLeft="@+id/lblNPCode" android:layout_below="@+id/lblNPCode" android:layout_centerHorizontal="true"/> <EditText android:id="@+id/txtCNPCode" android:layout_width="fill_parent" android:layout_height="wrap_content" android:textSize="18sp" android:layout_alignLeft="@+id/lblCNPCode" android

How to retain EditText data on orientation change?

牧云@^-^@ 提交于 2019-11-27 20:04:34
I have a Login screen which consists of 2 EditTexts for Username and Password. My requirement is that on orientation change , input data(if any) in EditText should remain as it is and a new layout should also be drawn. I have 2 layout xml files- one in layout folder and other in layout-land folder. I am trying to implement following 2 approaches but none of them is perfect: (1) configChanges:keyboardHidden - In this approach, I don't provide "orientation" in configChanges in manifest file. So I call setContentView() method in both onCreate() and onConfigurationChanged() methods. It fulfills

Android programmatically disable autocomplete/autosuggest for EditText in emulator

老子叫甜甜 提交于 2019-11-27 19:58:51
Targeting Android 2.2 I have read the answers to the following questions: Turn off autosuggest for EditText? Android: Multiline & No autosuggest in EditText I have tried the following variations on the suggestions: setInputType(InputType.TYPE_CLASS_TEXT | InputType.TYPE_TEXT_FLAG_NO_SUGGESTIONS); setInputType(InputType.TYPE_CLASS_TEXT | InputType.TYPE_TEXT_VARIATION_FILTER); setInputType(InputType.TYPE_CLASS_TEXT | InputType.TYPE_TEXT_VARIATION_FILTER | InputType.TYPE_TEXT_FLAG_NO_SUGGESTIONS); setInputType(InputType.TYPE_TEXT_VARIATION_NORMAL | InputType.TYPE_TEXT_FLAG_NO_SUGGESTIONS);

Can we have uneditable text in edittext

寵の児 提交于 2019-11-27 19:48:29
I am using an EditText . Is it possible to have a part of text uneditable and the rest editable in the same EditText ? Josef Pfleger You could use editText.setFocusable(false); or editText.setEnabled(false); although disabling the EditText does currently not ignore input from the on-screen keyboard (I think that's a bug). Depending on the application it might be better to use an InputFilter that rejects all changes: editText.setFilters(new InputFilter[] { new InputFilter() { public CharSequence filter(CharSequence src, int start, int end, Spanned dst, int dstart, int dend) { return src.length(

How to change the focus to next edit text in android?

﹥>﹥吖頭↗ 提交于 2019-11-27 19:44:49
The User can enter only one digit in the edit text. if he enters the value in edtText1, I want the cursor automatically moves to edtText2 and so on. The user can able to edit the text which he/she has entered already. I tried the following way. edtPasscode1.setOnKeyListener(new OnKeyListener() { @Override public boolean onKey(View v, int keyCode, KeyEvent event) { // TODO Auto-generated method stub if (edtPasscode1.getText().length() == 1) edtPasscode2.requestFocus(); return false; } }); edtPasscode2.setOnKeyListener(new OnKeyListener() { @Override public boolean onKey(View v, int keyCode,

SoftKeyboard hiding EditText

回眸只為那壹抹淺笑 提交于 2019-11-27 19:25:26
I have a layout that uses an EditText to let users search a database and populate a ListView. The EditText is about 2/3 of the way from the top of the screen (positioned over an ImageView, and followed by some intro text.) The problem is that the soft keyboard hides the EditText, so the user can't see what he's typing. (I disabled the auto-suggest.) I've tried LinearLayout, RelativeLayout, paddings, and different alignments/centerings, but I still can't get it to work right. The EditText is either hidden, gets pushed off the top of the screen, or get "squished" and distorted. Suggestions???

EditText hint doesn't show

北城以北 提交于 2019-11-27 19:15:00
My EditText configured as follows won't show the hint: <EditText android:layout_width="fill_parent" android:layout_height="wrap_content" android:gravity="right" android:hint="The hint..." android:scrollHorizontally="true" android:singleLine="true" /> It works if I set android:gravity="left" or if I remove android:scrollHorizontally and android:singleLine attributes, which is not desirable. Any suggestions? using android:ellipsize="end" fixed it for me Weird bug !! (but Android has a lot of these weirdo bug) In Lollipop version the default text and hint text color is white for EditText . So we