android-edittext

Android Form with EditText makes the screen flash

不羁岁月 提交于 2019-12-23 21:58:02
问题 I don't know why my "Forms" activity are flashing when an EditText are focused and then a layout is scrolled. It just happen in devices with Android 4.0 + I am using a Table Layout and adding TableRow dynamically. My TableRow is like that: <TableRow xmlns:android="http://schemas.android.com/apk/res/android" android:id="@+id/tableRow1" android:layout_width="fill_parent" android:layout_height="wrap_content" android:background="@drawable/borda" android:layout_margin="10dip" android:paddingLeft=

Android: Handle backspace on InputFilter

与世无争的帅哥 提交于 2019-12-23 21:53:22
问题 I created an InputFilter for an EditText component that only allows doubles within a range (e.g. from 1.5 to 5.5). Everything worked fine until I deleted the decimal point: I typed 1.68 and then deleted the decimal point. The value in the text field became 168, which is obviously outside the range. Here is a simplified version of my filter public CharSequence filter(CharSequence source, int start, int end, Spanned dest, int dstart, int dend) { if (isValid(dest.toString() + source.toString()))

How to show copy-paste options (Context menu) for MultiAutoCompleteTextView on button click?

喜你入骨 提交于 2019-12-23 20:19:19
问题 I am trying to show context menu (copy-paste options) for MultiAutoCompleteTextView when clicked on button. Here is what I have tried but did not work. mButton.setOnLongClickListener(new OnLongClickListener() { @Override public boolean onLongClick(View v) { // the below line didn't work either. //mAutoCompleteTextView.showContextMenu(); mAutoCompleteTextView.performLongClick(); return true; } }); Is there any way to show context menu? Menu is shown when I long press MultiAutoCompleteTextView,

Issue with EditText in Listview softkeyboard

天大地大妈咪最大 提交于 2019-12-23 19:21:49
问题 I have a Listview with row layout contains two textviews and a edittext In my activity i use android:windowSoftInputMode="adjustResize|stateHidden" and in edittext arguments are: <EditText android:id="@+id/et_quantity_test" android:layout_width="0dp" android:layout_weight="2" android:layout_height="wrap_content" android:inputType="numberSigned" android:gravity="center_vertical|left" android:layout_gravity="center_vertical|left" android:paddingLeft="3dp" android:imeOptions="actionNext" android

screen scrolling up when clicking on any EditText

混江龙づ霸主 提交于 2019-12-23 18:35:22
问题 I have one screen with 4 EditText like menuName, DishName,Tag and Price. I need to set my tag Edittext at top(+56dip) on clicking on it. Right now it's working fine. When i click on Tag EditText then it's shift up like what i want. Where i stuck Shifting layout up is working fine but if i click on other EditText then it will also shifting up which i don't want. I just wan't scroll Screen up when i click on Tag EditText. Here is my java code. final View activityRootView = findViewById(R.id

Soft keyboard “del” key fails in EditText on Gallery widget

橙三吉。 提交于 2019-12-23 18:34:19
问题 I am developing an application in Eclipse build ID 20090920-1017 using android SDK 2.2 and testing on a Google Nexus One. For the purposes of the tests below I am using the IME "Android keyboard" on a non-rooted phone. I have an EditText widget which exhibits some very strange behavior. I can type text, and then press the "del" key to delete that text; but after I enter a 'space' character, the "del" key will no longer remove characters before that space character. An example speaks a

How to prevent user from entering zero as an input?

一世执手 提交于 2019-12-23 18:28:06
问题 I'm trying to add input validation to a set of three EditTexts that the user enter numeric values into. The problem I'm facing is for the calculation to work the user can't enter zero as one of the input fields or the application will crash. I tried to implement the following to prevent zero from being entered and show a warning message.I get an error stating that "unable to start activity calcResult" which is the activity that shows the calculation. This is the link to the error log: http:/

Get text from an EditText

爱⌒轻易说出口 提交于 2019-12-23 18:18:39
问题 In my app I have an EditText that I want to get the value out of when it looses focus. How should I do this? Thanks! 回答1: Along the lines of this should work. EditText.setOnFocusChangeListener(new View.OnFocusChangeListener() { @override public void onFocusChange(View v, boolean hasFocus) { if (!hasFocus) { string value = (EditText) v.getText().ToString(); } } } 来源: https://stackoverflow.com/questions/7612069/get-text-from-an-edittext

Android : KeyListener of EditText not working

南楼画角 提交于 2019-12-23 18:05:35
问题 I'm trying to filter the input char of an EditText to allow only valid float value. (e.g. :"12,45", only one comma, ...). For this, I use the KeyListener (dont confuse with onKeyListener or textChangeListener. I want to prevent the user from entering invalid data). On Android 2.3.6 and 3.2 the keyListener.filter() and keyListener.getAcceptedChars() are not called and I can introduce any char (not limited to .getAcceptedChars()) I found little documentations about keyListener. If you got a

How to check if an editText box(s) is empty or not in android using Java [duplicate]

筅森魡賤 提交于 2019-12-23 17:31:45
问题 This question already has answers here : Check if EditText is empty. [closed] (30 answers) Closed 3 years ago . In my app, I have around 5 editText boxes in every screen.I want to check if they are empty or not and if all the text boxes are not empty, then there is an intent which takes you to the next screen. I want to know what code to write. 回答1: Just add this code in your java file when you want to call the intent. EditText editTextBox1 = (EditText) findViewById(R.id.your_editTextBox1_id)