android-edittext

Android Studio - Error inflating class EditText

房东的猫 提交于 2019-12-10 11:03:41
问题 I have been trying to solve this problem for a full day now. I created a new project in Android Studio and chose the tab navigation activity. From there I added a simple EditText in the XML of fragment_main.xml and run it. It always gives me an EditText inflation error. This does not happen with any other element e.g. TextViews fragment_main.xml: <RelativeLayout xmlns:android="http://schemas.android.com/apk/res/android" xmlns:tools="http://schemas.android.com/tools" android:layout_width=

how can i underline each character in edittext?

六月ゝ 毕业季﹏ 提交于 2019-12-10 10:38:12
问题 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

Android: showing text in EditText from start

浪尽此生 提交于 2019-12-10 10:18:10
问题 I have an EditText view in my xml file with a certain width. I have forced it to 1 line, so that if the entered text is longer than the width of my edit text, the text does not wrap around by using: android:singleLine="true" However, after entering a long text (longer than the width of edit text) it shows the last part of the text. I would like after user finishes entering the text, the text to be shown from the start. For example assume I have an edit text with a width that only accepts 4

Change PasswordToggle Gravity to the left (for RTL language)

旧时模样 提交于 2019-12-10 10:16:37
问题 I use TextInputLayout to get password from user like this: <android.support.design.widget.TextInputLayout android:id="@+id/RegisterPassInput" android:layout_width="match_parent" android:layout_height="wrap_content" android:layout_marginLeft="16dp" app:passwordToggleEnabled="true" android:layout_marginRight="16dp" android:layout_toStartOf="@+id/RegisterPassImg"> <EditText android:id="@+id/RegisterPassET" android:layout_width="match_parent" android:layout_height="wrap_content" android:gravity=

Line Numbers, Code Highlighting in TextView

☆樱花仙子☆ 提交于 2019-12-10 09:47:22
问题 I'm working on an 'IDE' for Android - it could be useful for editing short scripts / making quick adjustments to files. At the moment I'm just using a simple EditText, but I am wanting to add several features, for example Line Numbering down the left hand side of the EditText and Code Highlighting. Does anyone have any suggestions about how to approach this? For the code highlighting, I'm guessing I'll need to write my own subclass of EditText. For the line numbering, could I have a thin

Edit Text focus in android

别来无恙 提交于 2019-12-10 09:02:19
问题 In my application i have edit text as follows. EditText1 EditText2 EditText3 EditText4 EditText5 EditText6 in xml i declared android:imeOptions="actionNext" and also i write editText1.setOnEditorActionListener(new EditText.OnEditorActionListener() { public boolean onEditorAction(TextView v, int actionId, KeyEvent event) { // TODO Auto-generated method stub if (actionId == EditorInfo.IME_ACTION_DONE || actionId == EditorInfo.IME_ACTION_NEXT) { editText2.requestFocus(); return false; } return

Android (Lollipop) EditText onFocus fired multiple times

纵饮孤独 提交于 2019-12-10 06:18:16
问题 I have a couple of EditTexts with onFocusChangeListeners // When the field gains or loses focus txtMinimumValue.setOnFocusChangeListener(new View.OnFocusChangeListener() { @Override public void onFocusChange(View view, boolean hasFocus) { editFocusChange(view, hasFocus); } }); I'm not having any issues on pre-Lollipop devices, but any Nexus 5's and the onFocusChange is fired about 7 times. I found this SO: Custom ListAdapter consisting of EditText lose focus called twice and then I found this

EditText input with pattern android

早过忘川 提交于 2019-12-10 03:02:36
问题 I am having a EditText in which I have to accept alphanumeric input from user which is specific to pattern, and hyphens '-' are inserted automatically. "XXX-XXX-XXXX" how to achieve that ? Is there any pattern tool in android ? 回答1: You can use addTextChangedListener to EditText Refer this question , which demonstrate it 回答2: You can achieve that with PatternedTextWatcher. Edit: EditText editText = (EditText) findViewById(R.id.edittext); // Add text changed listener for automatic dots

Automatically format phone number in EditText

让人想犯罪 __ 提交于 2019-12-10 02:39:51
问题 In my app, the user has to enter a phone number in an EditText field using the following format: 1(515)555-5555 I don't want the user to type "(", ")", or "-" while entering the number; I want these characters to be added automatically. For example, suppose the user typed 1 -- the parenthesis after "1" should be added automatically, so that "1(" would be displayed. And I would like to have similar functionality while deleting. I have tried to set text in the afterTextChanged method of

android : TextInputLayout hides drawableRight of child EditText

佐手、 提交于 2019-12-10 02:30:48
问题 I am always updated with library updates, and this is what it resulted into. In build.gradle(Project:xxx): classpath 'com.android.tools.build:gradle:2.2.0-beta1' In build.gradle(Module:app) compile 'com.android.support:appcompat-v7:24.2.0' compile 'com.android.support:design:24.2.0' And put password field as below: <android.support.design.widget.TextInputLayout android:layout_width="match_parent" android:layout_height="wrap_content"> <android.support.v7.widget.AppCompatEditText android:layout