android-edittext

Is there a way to programmatically scroll a scroll view to a specific edit text?

邮差的信 提交于 2019-12-17 02:55:17
问题 I have a very long activity with a scrollview. It is a form with various fields that the user must fill in. I have a checkbox half way down my form, and when the user checks it I want to scroll to a specific part of the view. Is there any way to scroll to an EditText object (or any other view object) programmatically? Also, I know this is possible using X and Y coords but I want to avoid doing this as the form may changed from user to user. 回答1: private final void focusOnView(){ your

EditText error icon and show password missplaced

送分小仙女□ 提交于 2019-12-17 02:52:02
问题 I have an EditText as password input like this <android.support.design.widget.TextInputLayout android:layout_width="match_parent" android:layout_height="wrap_content"> <EditText android:id="@+id/password" android:layout_width="match_parent" android:layout_height="wrap_content" android:hint="@string/prompt_password" android:imeActionId="@+id/login" android:imeActionLabel="@string/action_sign_in_short" android:imeOptions="actionUnspecified" android:inputType="textPassword" android:maxLines="1"

EditText error icon and show password missplaced

空扰寡人 提交于 2019-12-17 02:51:03
问题 I have an EditText as password input like this <android.support.design.widget.TextInputLayout android:layout_width="match_parent" android:layout_height="wrap_content"> <EditText android:id="@+id/password" android:layout_width="match_parent" android:layout_height="wrap_content" android:hint="@string/prompt_password" android:imeActionId="@+id/login" android:imeActionLabel="@string/action_sign_in_short" android:imeOptions="actionUnspecified" android:inputType="textPassword" android:maxLines="1"

Android: Force EditText to remove focus? [duplicate]

十年热恋 提交于 2019-12-17 02:37:47
问题 This question already has answers here : How to stop EditText from gaining focus at Activity startup in Android (52 answers) Closed 4 years ago . I would like to be able to remove the focus from the EditText. For example if the Keyboard appears, and the user hides it with the back button, I would like the focus and the cursor to disappear. How can it be done? 回答1: You can add this to onCreate and it will hide the keyboard everytime the activty starts. You could also programatically change the

how to set only numeric value for edittext in android?

我的未来我决定 提交于 2019-12-17 02:27:12
问题 I have an edittext in which I want only integer values to be inserted. Can somebody tell me which property I have to use? 回答1: I guess android:inputType="number" at the xml attributes. 回答2: For example: <EditText android:id="@+id/myNumber" android:digits="0123456789." android:inputType="numberDecimal" /> 回答3: In code, you could do ed_ins.setInputType(InputType.TYPE_CLASS_NUMBER); 回答4: For only digits input use android:inputType="numberPassword" along with editText.setTransformationMethod(null

Saving EditText content in RecyclerView

隐身守侯 提交于 2019-12-17 01:41:07
问题 I have list item with EditText in it, I don't know how many items there will be. I have a problem when I enter some text in EditText , and then scroll down a RecyclerView , after I've scroll up again there is no text in my first EditText . I am wondering what, and where should I write code so that while the user is typing or finished typing (I was thinking to do that with a TextWatcher ) in the EditText the text gets saved into into a file (I'll save it in a .txt file in the external storage)

Check if EditText is empty. [closed]

我是研究僧i 提交于 2019-12-16 20:03:19
问题 Closed . This question needs to be more focused. It is not currently accepting answers. Want to improve this question? Update the question so it focuses on one problem only by editing this post. Closed last year . I have 5 EditTexts in android for users to input. I would like to know if I could have a method for checking all the 5 EditTexts if they are null. Is there any way to do this?? 回答1: I did something like this once; EditText usernameEditText = (EditText) findViewById(R.id.editUsername

I have a listview which contains more that 1 value in a row, how can i filter the list with a name value when i type in Edittext?

微笑、不失礼 提交于 2019-12-16 18:07:10
问题 If there was just one value in a row. I got the answer but i have more than one. This my main class which i couldnt decide how to fill Textwatcher stuff. "CityArray" is the class which i created the rows and "CityXmlParse" is the class that i take data from XML file called "cities.xml" in the raw folder. Each row has an image and a name and i want to filter the rows by name while typing, but whole row must be seen after typing (with image). public class TravelFinalActivity extends Activity {

I have a listview which contains more that 1 value in a row, how can i filter the list with a name value when i type in Edittext?

匆匆过客 提交于 2019-12-16 18:07:06
问题 If there was just one value in a row. I got the answer but i have more than one. This my main class which i couldnt decide how to fill Textwatcher stuff. "CityArray" is the class which i created the rows and "CityXmlParse" is the class that i take data from XML file called "cities.xml" in the raw folder. Each row has an image and a name and i want to filter the rows by name while typing, but whole row must be seen after typing (with image). public class TravelFinalActivity extends Activity {

Android EditText : How to avoid user enter smileys?

本小妞迷上赌 提交于 2019-12-14 04:25:15
问题 I would like to avoid to the user to put a smiley with the keyboard into an EditText . Is it possible ? 回答1: You can define your input type and only accept letters or change your keyboard type: https://developer.android.com/training/keyboard-input/style.html Or you can only accept some specific digits: How to create EditText accepts Alphabets only in android? 回答2: Editing answer from here. This will allow only ASCII characters to be entered in EditText. edittext.setFilters(new InputFilter[] {