android-edittext

Android dynamically add EditText in Linear Layout

拟墨画扇 提交于 2019-12-10 17:31:36
问题 I'm stuck trying to add an editText field dynamically under my existing editText fields using a button. Currently pressing the button does nothing. Here is my code: XML: <?xml version="1.0" encoding="utf-8"?> <android.support.constraint.ConstraintLayout xmlns:android="http://schemas.android.com/apk/res/android" xmlns:app="http://schemas.android.com/apk/res-auto" xmlns:tools="http://schemas.android.com/tools" android:layout_width="match_parent" android:layout_height="match_parent" android

How to Enable Default Copy paste on EditText

不羁岁月 提交于 2019-12-10 17:23:33
问题 I define Edittext inside xml layout but when i select text inside EditText default cut copy paste not appeare. here my xml code <EditText android:id="@+id/xEt" android:layout_width="match_parent" android:layout_height="match_parent" android:layout_gravity="center" android:ems="10" android:gravity="top" android:padding="15dp" android:singleLine="false" android:visibility="visible" /> my java code is: mEt = (EditText) findViewById(R.id.xEt); mEt.setTypeface(tf2); mEt.setTextColor(Color.BLACK);

TextInput layout turns editext into red on setting error

你说的曾经没有我的故事 提交于 2019-12-10 16:59:38
问题 I have a layout, whenever i press submit button and set error on text input layout it turns the editText into red but i hadn't set any color on editText on set error. Basically i just wanted to give the error string below the editText and not to turn editText into red on setting the error. My Fragment code is as follows, public class SignIn extends Fragment implements View.OnClickListener { TextInputLayout edEamil,edPassword; @Override public View onCreateView(LayoutInflater inflater,

change the keyboard layout after a button click

微笑、不失礼 提交于 2019-12-10 16:45:54
问题 I'm developping an android app , and i have an EditText and a two RadioButtons ( A and B ), what i'm trying to do is : When RadioButton A is checked , i want to change the keyboard layout to display it with the Done button , When the RadioButton B is checked, i want to change the keyboard layout to display it with the Search Button . I've tried to change the IMEOptions of my EditText like this , but it still doesn't work : NB : the keyboard is already visible, what i want to do is just modify

How to underline an EditText

廉价感情. 提交于 2019-12-10 16:38:40
问题 I am having some problems to underline an EditText in AndroidStudio. This is what I am looking for (this is just a photo, not my real text): enter image description here But I do not really know any property to do that. My code right now is really simple. Just the "normal" one: <EditText android:layout_width="match_parent" android:layout_height="wrap_content" android:inputType="textPersonName" android:ems="10" android:layout_margin="16dp" android:id="@+id/tx_titulo" android:layout

How to set border color for EditText

戏子无情 提交于 2019-12-10 16:17:33
问题 I have used this. <color name="edt_pressed">#99CBFF</color> <color name="edt_focused">#CEF7F6</color> <color name="edt_default">#000000</color> gradient_edt_focused <?xml version="1.0" encoding="utf-8"?> <shape xmlns:android="http://schemas.android.com/apk/res/android" android:shape="rectangle"> <stroke android:width="1dip" android:color="@color/edt_focused" /> </shape> edt_border.xml <?xml version="1.0" encoding="utf-8"?> <selector xmlns:android="http://schemas.android.com/apk/res/android" >

Edittext keeps focus when keyboard up AND scrolling the listview

天涯浪子 提交于 2019-12-10 16:02:01
问题 I use a listview. Each item in the list contains one edittext. When I click on an edittext, the soft keyboard pops up, the edittext I clicked on gains the focus for a short time and then lose it. I have to click a second time to really get the focus (why?) ( focus on an editext and keyboard up ) I scroll the listview ... Because the listview elements are recycled, the focus reappears on edittext at other positions in the list and I guess this is normal BUT why does Android not remove this

EditText setError not working in PopupWindow

試著忘記壹切 提交于 2019-12-10 15:56:13
问题 I had popup window with custom layout which has edittext . I'm trying to show error message in edittext with setError method, but it's giving following exception. android.view.WindowManager$BadTokenException: Unable to add window -- token android.view.ViewRootImpl$W@211ffd68 is not valid; is your activity running? at android.view.ViewRootImpl.setView(ViewRootImpl.java:579) at android.view.WindowManagerGlobal.addView(WindowManagerGlobal.java:282) at android.view.WindowManagerImpl.addView

How can I have both a return and a done keys in an EditText's softkeyboard?

左心房为你撑大大i 提交于 2019-12-10 15:54:56
问题 how can I have both a "done" (close the softkeyboard) and a "return" (line break) keys in my softkeyboard (Samsung Galaxy 10.1, Android 3.1, portrait mode) when writing in an EditText? Using <EditText android:id="@+id/comment" android:layout_width="772dp" android:layout_height="200dp"/> I get Thanks 回答1: That may depend on the application and what you mean by 'done'. But, the KeyCode DPAD_UP and _DOWN ("arrow keys") will normally move the cursor to the next EditText. 来源: https://stackoverflow

Custom edit text with borders [duplicate]

我的未来我决定 提交于 2019-12-10 15:28:50
问题 This question already has answers here : Outlined Edit Text from Material Design (5 answers) Closed 4 months ago . I am trying to put borders on edit text and put a label on it. I have made the border like this : <?xml version="1.0" encoding="UTF-8"?> <shape xmlns:android="http://schemas.android.com/apk/res/android"> <stroke android:width="1dp" android:color="#A0A0A0" /> </shape> but I am not able to achieve my desired result. I want something like below : please help. 回答1: Try this: <?xml