android-edittext

Remove whole Spannable with backspace

喜欢而已 提交于 2019-12-05 01:27:53
I have a chat application which offers the possibility to add emoticons to the text. I have a problem with the EditText field. The emoticon images show up but if I press on the normal keyboard the backspace button, the text which I was changing to an emoticons picture shows up and I have to remove several characters until the picture goes away. I am using Spannable to do this. I want the whole smilie go away if the user presses one time backspace. Here the code I am using: // This is in the keyclicked listener { ... smilie = "(angel)"; break; ... int cursorPosition = content.getSelectionStart(

Automatically format phone number in EditText

穿精又带淫゛_ 提交于 2019-12-05 01:20:26
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 onTextWatcher interface, but it is not working; instead it's causing an error. Any help will be greatly

EditText input type textCapSentences not working on Lollipop

你离开我真会死。 提交于 2019-12-05 01:19:55
I have implemeted android:inputType="textAutoComplete|textCapSentences" in my xml code. When I run it on kitkat , textCapSentence works fine but when build is run on Lollipop device it does not work. Anybody knows how to solve it. Hi this is because in lollipop if you have disabled Auto - Capitalization in keyboard settings then you can't enable it programmatically. here are the steps:- Tap icon of ‘Settings’ on the Home screen of your Android Lollipop Device At the ‘Settings’ screen, scroll down to the PERSONAL section and tap the ‘Language & input’ section. At the ‘Language & input’ section,

How to clear the text in edittext

女生的网名这么多〃 提交于 2019-12-05 01:17:06
I want to clear the text in EditText after it has been saved in database. Here is my code: pictureDescription.addTextChangedListener(new TextWatcher() { public void afterTextChanged(Editable textValue) { String content = textValue.toString(); db.updatePicDes(content,lastSnapId); } } Use editText.getText().clear() . Just set it to empty string. I think it should do it. EditText editText = (EditText)findViewById(R.id.edit_text); editText.setText(""); Via you can use EditText.setText(""); You better do that in FocusChangedListener if you donot want it on clicking a button. pictureDescription

Change the color of the cursor of an EditText in Android 3.0

点点圈 提交于 2019-12-05 00:53:55
I have to have an EditText in my application with a white background. I did this in my theme.xml file <style name="myEditText" parent="@android:style/Widget.EditText"> <item name="android:background">#ffffffff</item> <item name="android:textColor">#ff000000</item> </style> The problem now is that the cursor is still white and therefore not visible. I did some googling and found this question here on StackOverflow: Set EditText cursor color The way it's done there is the android:textCursorDrawable key. But this key does seem to be only available with a 3.2 target. But our clients wants a 3.0

Android: How to clear an EditText by cross Button in the right side

你。 提交于 2019-12-05 00:46:21
I have created an EditText for search, which contains on the left side a search icon and on the right side of icon: <EditText android:id="@+id/Search" android:layout_width="250dp" android:layout_height="wrap_content" android:drawableLeft="@android:drawable/ic_menu_search" android:drawableRight="@android:drawable/ic_delete" android:hint="Search Product .." > </EditText> I want to know how can I clear the content of EditText when I click the cross button. Thank you in advance. Paul Verest An improved answer by @aristo_sh from Handling click events on a drawable within an EditText mQueryEditText

Android Button needs two click for action

吃可爱长大的小学妹 提交于 2019-12-05 00:04:50
I have a form. 7 EditText in vertical layout. On screen in one moment can see only 3 EditText (form is big so I need to scroll up and down to fill all fileds). In bottom - Button. When I fill top EditText (or one of top, wich is invisible when I scrolled down to button), and focus (cursor) in this EditText, when I scrolled down and try to click Button once - nothing happens. when I click again - happens button action. When both EditText with focus and Button is visible - Button needs one clicks. I think that in first case first click just takes focus. And second click is "real" click. How I

Android EditText Binding is broken after MvvmCross update from 4.2.3 to 4.4.0 with Linker enabled

你说的曾经没有我的故事 提交于 2019-12-05 00:02:52
问题 My MvvmCross Android app which was working before now is broken because of MvvmCross update from 4.2.3 to 4.4.0 <EditText android:layout_width="match_parent" android:layout_height="match_parent" local:MvxBind="Text Login" /> public string Login { get { return _login; } set { SetProperty(ref _login, value); } } LinkerPleaseInclude if of course there: public void Include(EditText text) { text.Enabled = !text.Enabled; text.TextChanged += (sender, args) => text.Text = "" + text.Text; text.Hint =

EditText - Gap between text and EditText's line

寵の児 提交于 2019-12-04 23:52:14
When I insert text to my EditText field the text has an abnormal gap between itself and the EditText 's line. Here's a printscreen from my terminal where you can see this gap I'm talking about, it is marked in red. I've played around with text alignment and gravity but to no success. Here's the XML: <RelativeLayout xmlns:android="http://schemas.android.com/apk/res/android" xmlns:tools="http://schemas.android.com/tools" android:layout_width="match_parent" android:layout_height="match_parent" android:paddingBottom="@dimen/activity_vertical_margin" android:paddingLeft="@dimen/activity_horizontal

RecyclerView: Disable scrolling caused by change in focus

爷,独闯天下 提交于 2019-12-04 23:33:29
问题 TL;DR I have a RecyclerView of EditText s. When the user is focused on EditText #1 and taps on EditText #2 , I want EditText #2 to get focus but I don't want the ReyclerView to scroll. How can I achieve this? I'm trying to work with a RecyclerView populated with a bunch of EditText s. When I'm focused on one EditText and I click on another, the RecyclerView scrolls so that the second is at the top of the screen. I want to disable this auto-scrolling from the RecyclerView , but I still want