android-edittext

EditText getHint() returns null when using design support library

*爱你&永不变心* 提交于 2019-12-03 18:01:30
问题 When using EditText in combination with Design lib's (ver 22.2.1) TextInputLayout getting hint programmatically returns null. I'm trying to append asterisk '*' to a mandatory field programmatically, hence EditText.getHint() but the fact that it returns null is an issue in this case. EditText editText = (EditText) findViewById(R.id.edit2); String hint = String.format("%s *", editText.getHint()); editText.setHint(hint); A simple code illustration: Layout.xml: <android.support.design.widget

How to create an interface to get info from a Fragment to an Android Activity?

孤者浪人 提交于 2019-12-03 17:34:47
Over the past days I've desperately been trying to build an android app with a simple fragment (which I use twice). I want to pass the contents of the fragments' EditText-boxes to a new activity. I just can't figure out how to get those contents from the fragments. What I have so far is this: I've got my edit_text_fragment.xml : <?xml version="1.0" encoding="utf-8"?> <LinearLayout xmlns:android="http://schemas.android.com/apk/res/android" android:layout_width="match_parent" android:layout_height="match_parent" android:orientation="vertical" > <EditText android:id="@+id/my_edit_text" android

What's the right way to extend EditText to give it additional “default” functionality

丶灬走出姿态 提交于 2019-12-03 17:20:16
问题 I'm wondering if it's possible to add functionality to EditText such that when I include my newly extended field in the layout xml, I don't have to then add any code to the Activity class to get it to behave in specific ways. For example, I'd like to make a EditPhone field which is just an EditText that has the added feature of listening for key events and modifying the field to include parenthesis and dashes in their appropriate locations. At the moment, I'm always having to include the

Edittext change width with animation

纵然是瞬间 提交于 2019-12-03 17:20:00
I want to make an edittext which aligns in its parent's left and when users click it, edittext's width'll increase to right side. Here is the code that i used. But when animation ended, edittext width come to first size. Can any one help me.? And is there any solution to set "fillparent" to width's final size in animation? Animation scaleAnimation = new ScaleAnimation(0, -500, 1, 1); scaleAnimation.setDuration(750); editText.startAnimation(scaleAnimation); I added scaleAnimation.setFillAfter(true); before animation starts but i get this; After 750ms, edittext is going to its first width. This

How to apply global custom style to android.support.design.widget.TextInputEditText?

扶醉桌前 提交于 2019-12-03 17:11:31
问题 I have my AppTheme defined in style.xml where I apply a custom style globally for all my app's TextView , EditText , Button etc. Now I'd like to do the same for android.support.design.widget.TextInputEditText but how? It does not extend EditText so that style is ignored. Here's what I've got: <?xml version="1.0" encoding="utf-8"?> <resources> <style name="AppTheme" parent="@style/Theme.AppCompat.Light.NoActionBar"> <item name="colorPrimary">@color/primary</item> <item name="colorPrimaryDark">

Why my EditText copy/paste menu is under the EditText? How change the z-order of popup window?

半腔热情 提交于 2019-12-03 17:07:11
问题 NOTE If someone know how to order (z-order) Windows added via windowmanager, i will also accept the answer because it's will answer all the question. Actually i only find to do windowManager.removeView(MyView) following immediatly by windowManager.addView(MyView) to put a view in front of the other, but this is not ideal because it's visually remove and add the view. it's look crazy that their is no build in function in android to do such a simple think. I create a view (linearlayout) that

How to customize the “chips” auto-suggesting mechanism, as used on Gmail's recipients field?

寵の児 提交于 2019-12-03 16:46:27
问题 Background I've searched for a way to have a similar look & feel to the Gmail receipients field, which allows auto-filling of items in a really cool way: The class that is built into the Android framework and is responsible for this is called "MultiAutoCompleteTextView" . The problem the MultiAutoCompleteTextView is quite basic, yet it doesn't hold enough samples, tutorials and libraries to get to know how to customize it like on Gmail and the likes. I would like to know how to customize it

Android: Remove Enter Key from softkeyboard

天大地大妈咪最大 提交于 2019-12-03 16:32:36
问题 In my login form when user clicks on an EditText and presses the enter key, this inserts a new line, therefore increasing the EditText's size. Next moment, it returns to its previous place and prints a dot in the password field (which is the next field). I want to remove this enter key from the softkeyboard. Is it possible? 回答1: I am afraid you can't do this. But one thing is you can handle the softkeyboard keyevents like this, edittext.setOnKeyListener(new OnKeyListener() { public boolean

Issue in Changing EditText background after setting error to the TextInputLayout on Android M

拈花ヽ惹草 提交于 2019-12-03 16:25:19
I have set custom background to the EditText in Xml file. After validation, i am setting different background to EditText at runtime and also setting error to TextInputLayout. But in Android M instead of setting background resource, it is setting background color to EditText. This is image before setting error to the TextInputLayout This is the image after setting error to the TextInputLayout Below is my code:- XML file code <android.support.design.widget.TextInputLayout android:id="@+id/input_layout_name" android:layout_width="fill_parent" android:layout_height="wrap_content" android:layout

Android EditText: Done instead of Enter or Word Wrap instead of Multi Line

回眸只為那壹抹淺笑 提交于 2019-12-03 16:06:46
问题 I have a multiple line EditText that does not permit line returns. Right now I am replacing returns with some spaces as soon as they click save. Is there any way I can replace the on screen enter button with a Done button? (like it is for single line EditText) I am aware that I should still strip out returns ( \r\n|\r|\n ) because the on screen keyboard is not the only way to add them. Here is my current XML <EditText android:layout_width="fill_parent" android:layout_height="wrap_content"