android-edittext

How to draw rounded rectangle in Android UI?

荒凉一梦 提交于 2019-12-17 06:25:13
问题 I need to draw a rounded rectangle in the Android UI. Having the same rounded rectangle for TextView and EditText would also be helpful. 回答1: In your layout xml do the following: <shape xmlns:android="http://schemas.android.com/apk/res/android" android:shape="rectangle"> <solid android:color="@android:color/holo_red_dark" /> <corners android:radius="32dp" /> </shape> By changing the android:radius you can change the amount of "radius" of the corners. <solid> is used to define the color of the

Disable EditText context menu

人走茶凉 提交于 2019-12-17 06:15:16
问题 I am making a vertical EditText for traditional Mongolian. I have successfully implemented it by embedding a slightly modified EditText inside of a rotated ViewGroup . I need to create a completely custom context menu because the system one does not support vertical text and is also not rotated when the ViewGroup is rotated. So I want to disable the system context menu altogether. Note that this is different than these questions that are just trying to disable copy/paste/etc.: How to disable

Disable EditText context menu

╄→гoц情女王★ 提交于 2019-12-17 06:15:16
问题 I am making a vertical EditText for traditional Mongolian. I have successfully implemented it by embedding a slightly modified EditText inside of a rotated ViewGroup . I need to create a completely custom context menu because the system one does not support vertical text and is also not rotated when the ViewGroup is rotated. So I want to disable the system context menu altogether. Note that this is different than these questions that are just trying to disable copy/paste/etc.: How to disable

How to remove all listeners added with addTextChangedListener

二次信任 提交于 2019-12-17 06:00:39
问题 I have a ListView where each row has an EditText control. I want to add a TextChangedListener to each row; one that contains extra data which says which row the EditText was in. The problem is that as getView gets called, multiple TextWatchers are added; because the convertView already having a TextWatcher (and one that points to a different row). MyTextWatcher watcher = new MyTextWatcher(currentQuestion); EditText text = (EditText)convertView.findViewById(R.id.responseText); text

How to remove all listeners added with addTextChangedListener

*爱你&永不变心* 提交于 2019-12-17 05:59:47
问题 I have a ListView where each row has an EditText control. I want to add a TextChangedListener to each row; one that contains extra data which says which row the EditText was in. The problem is that as getView gets called, multiple TextWatchers are added; because the convertView already having a TextWatcher (and one that points to a different row). MyTextWatcher watcher = new MyTextWatcher(currentQuestion); EditText text = (EditText)convertView.findViewById(R.id.responseText); text

How to remove all listeners added with addTextChangedListener

末鹿安然 提交于 2019-12-17 05:59:05
问题 I have a ListView where each row has an EditText control. I want to add a TextChangedListener to each row; one that contains extra data which says which row the EditText was in. The problem is that as getView gets called, multiple TextWatchers are added; because the convertView already having a TextWatcher (and one that points to a different row). MyTextWatcher watcher = new MyTextWatcher(currentQuestion); EditText text = (EditText)convertView.findViewById(R.id.responseText); text

Android intercept paste\copy\cut on editText

血红的双手。 提交于 2019-12-17 05:56:53
问题 How can I intercept this kind of events ? I need to add some logic when the user trying to paste some text into my EditText i know i can use TextWatcher but this entrypoint not good for me becuase i only need to intercept in case of paste and not every time the user press my EditText , 回答1: Seems there isn't much you can do by using the API: android paste event Source reading to the rescue! I dug into the Android Source of the TextView ( EditText is a TextView with some different

Android intercept paste\copy\cut on editText

别说谁变了你拦得住时间么 提交于 2019-12-17 05:54:11
问题 How can I intercept this kind of events ? I need to add some logic when the user trying to paste some text into my EditText i know i can use TextWatcher but this entrypoint not good for me becuase i only need to intercept in case of paste and not every time the user press my EditText , 回答1: Seems there isn't much you can do by using the API: android paste event Source reading to the rescue! I dug into the Android Source of the TextView ( EditText is a TextView with some different

How to replicate android:editable=“false” in code?

早过忘川 提交于 2019-12-17 04:59:21
问题 In the layout you can set the EditText widget to be non-editable via the android:editable attribute . How can I do this in code? I need to make the EditText widget to be editable depending on conditions. 回答1: I think an InputFilter that rejects all changes is a good solution: editText.setFilters(new InputFilter[] { new InputFilter() { public CharSequence filter(CharSequence src, int start, int end, Spanned dst, int dstart, int dend) { return src.length() < 1 ? dst.subSequence(dstart, dend) :

Set Focus on EditText

丶灬走出姿态 提交于 2019-12-17 04:46:36
问题 I have an EditText-Field and set an OnFocusChangeListener for it. When it has lost focus, a method is called, which checks the value of the EditText with one in the database. If the return-value of the method is true, a toast is shown and the focus should get back on the EditText again. The focus should always get back on the EditText and the keyboard should show, until the return-value of the method is false. EDIT: I think, I haven't made my real problem perfectly clear yet: No other Item on