android-edittext

List view edittext data loses on scrolling in Android

独自空忆成欢 提交于 2019-12-08 05:47:33
问题 I want the listview having 2 edittexts to preserve the values even after becoming invisible after scrolling. And when the edittext losses focus, I want each edittext value to be saved in a arraylist (2 arraylist - one for quantites and one for prices), which I can later save to the database. I tried having the code in the OntextChanegd method, but it doesn't seem right. public class CustomAdapter extends BaseAdapter { ArrayList<String> names; Context context; ArrayList<String> itemPrices =

EditText on demand widget

三世轮回 提交于 2019-12-08 05:40:36
问题 I'd like to have a TextView display text, and when you click/longclick on it, a textbox should "show up" and allow editing of said text. When you're done editing (onkey enter i suppose) it should revert back to a textview with the updated text... I'm wondering if it's feasable to implement such a widget or should I hack a workaround? Tips and suggestions are very welcome. If you need further idea of what I mean, just go to your e.g. (windows) skype profile and see for yourself. EDIT:

Moving focus from one EditText to another

二次信任 提交于 2019-12-08 05:14:07
问题 I designed a layout for a create account activity. when one EditText loses focus, I'm doing some checking on the input and if something is not right I want to regain the focus on that EditText . I already saw some questions about this, but its not working for me (or I'm doing something wrong). when I touch on a different EditText which triggers the requestFocus(), the focus remains on the current EditText and another focus icon is shown in the EditText which requeted the focus. help please

Setting onClickListener to editText

六眼飞鱼酱① 提交于 2019-12-08 05:09:24
问题 Hi im trying to add on click listener to editText so i can disable the softkeyboard when user clicks on edittext using this code below, how to do that? InputMethodManager imm = (InputMethodManager)getSystemService(Context.INPUT_METHOD_SERVICE); imm.hideSoftInputFromWindow(edittext.getWindowToken(), 0); 回答1: First it needs to be focusable... <EditText ... android:inputType="none" android:focusable="false" ... /> You have to implement it in your code and than just add this to get an click

Multiple hints or multiple style for the same hint in edittext

流过昼夜 提交于 2019-12-08 05:06:33
问题 How to add to an EditText component another hint that will react as an hint, but with different as the default hint. For example: field name is city, so I would like the primary hint in black to be displayed as "city" and in light blue I would like it to be dislayed as "tap to select a city". Are there any ready-to-go components or xml attributes for it? Is this a case where I need Java code and implement onfocus and show/hide another TextView that will react as label? I got this as strings

Android add edittext field on click of (+) button and remove by click of (-)

扶醉桌前 提交于 2019-12-08 04:50:34
问题 I am creating a add contact activity. There will be only one edit text and a button (+), when click on button then another edit text should be added and previous button should change into (-). By this method i want to add and remove edit text fields.Some thing like this. I am doing like this but not able to achieve that i want. Any idea? public class TextField extends Activity { Context con; TableLayout table; TableRow tr[] = new TableRow[6]; EditText txt[] = new EditText[6]; //ImageView img[

Don't let AdMob ads request focus?

只谈情不闲聊 提交于 2019-12-08 04:48:08
问题 I have a EditText in a layout, and I also have AdMob ads at the bottom of the layout, when someone enters something in the EditText theres suppose to be a "Done" button in the button right corner of the keyboard, but after I added AdMob it has a "Next" button, and when you press it, it focuses on the Ad! Is there a way to disable this? My XML: <com.google.ads.AdView android:id="@+id/adView" android:focusable="false" android:layout_width="wrap_content" android:layout_height="wrap_content" ads

Place Icon at Top Left Corner in Multiline EditText

╄→гoц情女王★ 提交于 2019-12-08 04:28:23
问题 How Do I place icon at top left corner in multiline EditText, here is what I am using : <EditText android:id="@+id/editComments" android:layout_width="match_parent" android:layout_height="wrap_content" android:paddingLeft="10dp" android:paddingTop="10dp" android:paddingBottom="20dp" android:paddingRight="10dp" android:layout_margin="10dp" android:hint="Comments" android:inputType="textMultiLine" android:lines="4" android:drawablePadding="20dp" android:minLines="4" android:gravity="top|left"

Android EditText: how to apply spans when composing?

非 Y 不嫁゛ 提交于 2019-12-08 04:26:14
问题 How can I apply spans on EditText text when the user is composing? For example the user has activated "bold" when composing, so every character input since then should be bold . I thought about adding text change listener to the EditText and update the text as the user composes, but I wanna know if there's a better way of doing this. 回答1: The question was already answered in the comments, but to make it more permanent I will add a fuller answer. In order to set a span (like Bold) wherever the

enable edit box only after selecting the radio button

拈花ヽ惹草 提交于 2019-12-08 04:02:21
问题 I have two radio buttons i.e., call and email. When call is selected then the edit box should get enabled and then user may enter the mobile number. I've checked these links: Enable a text box only when 1 of the radio button is clicked Enable text box based on radio button selected Making Text box not editable but am not able to achieve this task. Here is my code: <LinearLayout android:layout_width="fill_parent" android:layout_height="wrap_content" android:layout_marginRight="10dp" android