android-edittext

Unable to use drawable in EditText inside TextInputLayout

て烟熏妆下的殇ゞ 提交于 2019-11-28 14:24:34
I recently upgraded Android Design library from 24.2.1 to 25.0.0. After this the "drawableX" feature in EditText doesn't work. EDIT 01.11: I learned that setting drawable in xml works if you use android:drawableStart instead of android:drawableLeft. But setting setting drawables programatically does not work. I use this to make a "Clear"-button to empty the EditText. But this feature is broken now. I would appreciate any work-arounds or knowledge about if this is intentional from Google or a bug! My code for Clearable edit-text that worked before but doesn't now: public class

EditText items in a scrolling list lose their changes when scrolled off the screen

五迷三道 提交于 2019-11-28 14:15:38
I have a long scrolling list of EditText items created by a SimpleCursorAdapter and prepopulated with values from an SQLite database. I make this by: cursor = db.rawQuery("SELECT _id, criterion, localweight, globalweight FROM " + dbTableName + " ORDER BY criterion", null); startManagingCursor(cursor); mAdapter = new SimpleCursorAdapter(this, R.layout.weight_edit_items, cursor, new String[]{"criterion","localweight","globalweight"}, new int[]{R.id.criterion_edit, R.id.localweight_edit, R.id.globalweight_edit}); this.setListAdapter(mAdapter); The scrolling list is several emulator screens long.

How to hashtag value in different colour in EditText?

為{幸葍}努か 提交于 2019-11-28 14:06:10
I am writing some text in EditText when i write "#data" its colour should be changed but doesn't change how can i do. Please check the below EditText which i have used <EditText android:id="@+id/et_simple" android:layout_height="wrap_content" android:layout_width="match_parent"> </EditText> Hope this solution will help..! I used this solution it is very useful! like adding the textWatcher interface over your editText and listening to textChange and finding out if the word starts with a hashTag then call the Change The color method on that word! it has some flaws but those are ignorable see

Android: How to TOTALLY disable copy and paste function in Edittext

微笑、不失礼 提交于 2019-11-28 13:49:43
I am quite new to Android developing area and recently I hv encountered a tough problem. I was trying to make a Edittext which should NOT ALLOW user to copy content from or paste content to it. I hv googled a lot and find there seems to be 2 popular ways of doing so: 1st way, to set it in the layout file: android:longClickable="false" 2nd way, to programmatically set it: myEdittext.setCustomSelectionActionModeCallback(new ActionMode.Callback() { public boolean onPrepareActionMode(ActionMode mode, Menu menu) { return false; } public void onDestroyActionMode(ActionMode mode) { } public boolean

How to update the same EditText using TextWatcher?

可紊 提交于 2019-11-28 13:46:58
In my Android application I need to implement a TextWatcher interface to implement onTextChanged . The problem I have is, I want to update the same EditText With some extra string. When I try to do this the program terminates. final EditText ET = (EditText) findViewById(R.id.editText1); ET.addTextChangedListener(new TextWatcher() { @Override public void onTextChanged(CharSequence s, int start, int before, int count) { try { ET.setText("***"+ s.toString()); ET.setSelection(s.length()); } catch(Exception e) { Log.v("State", e.getMessage()); } } @Override public void beforeTextChanged

How to set the cursor to the right (EditText)?

怎甘沉沦 提交于 2019-11-28 13:31:35
How to set the cursor to the right with right align and hint text? Is it possible? I have a AutoCompleteTextView and a EditText with Text right align and an hint text. Now if one of them is focused the curser is before the hint and not at the end of the line. So it looks like now it's bad... I've also tried to set the cursor position, but it didn't help of course. <AutoCompleteTextView android:id="@+id/input_snm" android:layout_width="wrap_content" android:layout_height="wrap_content" android:layout_alignParentLeft="true" android:layout_alignParentRight="true" android:layout_below="@+id/input

Getting weird text back with EditText.toString() method in Android project. Why?

时光毁灭记忆、已成空白 提交于 2019-11-28 13:09:51
I appear to have a fundamental gap in my understanding of an EditText object. I have an Activity+Layout with a single EditText object. After I type a few characters into the EditText object and hit the Enter key, I retrieve the text in my onKey() listener. When I use the toString() method to retrieve the text I get back a weird string like: android.widget.EditText@43749ff0 Despite the fact the EditText.mText property does show the string I entered, "123" during my tests. Why is toString() returning a different result and what appears to be some kind of "uninitalize" value? How do I get the

EditText with custom theme shows underline under selection handle

浪尽此生 提交于 2019-11-28 12:51:25
i am trying to modify the underline color of a EditText by applying a theme. Style: <style name="MyTheme.EditText" parent="Widget.AppCompat.EditText"> <item name="colorControlActivated">@color/green</item> </style> EditText: <EditText android:id="@+id/editText_amount" android:layout_width="match_parent" android:layout_height="wrap_content" android:hint="@string/hint_enter_amount" android:theme="@style/MyTheme.EditText"/> Basically it works, but when i try to select or move the cursor the selection handle is also underlined. You can see this in the screenshot. Does someone know how to fix this?

EditText in Android doesn't show text when typing while using the on-screen keyboard

孤街醉人 提交于 2019-11-28 12:35:31
I have an activity consisting of 3 EditText fields (amongst other things like TextViews and a few buttons). I also have an AutoCompleteTextView with a list of String's using an ArrayAdapter. Whenever I test the app in an emulator, I can type when the keyboard is up but it doesn't show the text (it still gives predictions) and the text only appears in the EditText box once the keyboard is closed down. This happens when I test it on my phone, too. However, it works and shows up as you type on the emulator if the on-screen keyboard isn't up and you're just typing normally. I have no idea why!

Android - EditTexts within ListView bound to Custom ArrayAdapter - keeping track of changes

谁说胖子不能爱 提交于 2019-11-28 12:12:46
I have an Android activity in which I have a ListView bound to a custom ArrayAdapter. Each row of the ListView has two EditText (numeric) fields. The ArrayAdapter is initially populated from an SQLite DB. However the user can add a row at the end of the ListView, or (by long-pressing on a row) delete any row in the ListView. When they hit the 'Save' button, their changes are persisted. I am keeping track of changes as they are made by attaching a CustomTextWatcher for the AfterTextChanged() event to each EditText in the ArrayAdapter's getView() method (passing in the EditText and the