android-edittext

EditText with TextWatcher and Suggestions

非 Y 不嫁゛ 提交于 2019-12-12 16:30:57
问题 Moving an app from 2.2 to 3.x, one of my EditText's that I was using a TextWatcher on for validation is behaving badly. In short, when a user clicks on the EditText and the entire word goes into 'suggestions mode' (where it is underlined), it effectively gets removed from the EditText from the TextWatcher's perspective, triggering my text validation check that I do for an empty EditText. The code: mText = (EditText) findViewById(R.id.inpt_title); mText.addTextChangedListener(new TextWatcher()

Alert Dialog with a numeric EditText field

ⅰ亾dé卋堺 提交于 2019-12-12 16:26:03
问题 I am alerting the user with and alert dialog box that has an EditText field. AlertDialog.Builder alert = new AlertDialog.Builder(this); db.open(); Cursor f = db.getTitle(position + 1); alert.setTitle("Age"); alert.setMessage("New age?"); // Set an EditText view to get user input final EditText input = new EditText(this); alert.setView(input); input.setText(f.getString(3)); db.close(); alert.setPositiveButton("Change", new DialogInterface.OnClickListener() { public void onClick(DialogInterface

EditText wont display above ListView

删除回忆录丶 提交于 2019-12-12 15:39:32
问题 I have a ListView activity and I want an EditText (and ultimately a button along with it) to display above it. I believe my xml is fine, but for some reason the EditText is not displaying. The ListView takes up the entire screen :( Here's what my XML looks like: <?xml version="1.0" encoding="utf-8"?> <LinearLayout xmlns:android="http://schemas.android.com/apk/res/android" android:orientation="vertical" android:layout_width="fill_parent" android:layout_height="fill_parent" > <EditText android

How to prevent that the keyboard hides my EditText?

让人想犯罪 __ 提交于 2019-12-12 15:17:58
问题 I have a RelativeLayout at the top, then below i have a ListView in the center and finally at the bottom i have another relativeLayout with an EditText and a Button inside. I want the ListView to resize when I click on the EditText and the IME(virtual keyboard) appears. If i put adjustResize in the manifest, the Listview is resized to leave space for the IME, but the RelativeLayout with the EditText that is below is covered by the IME and I can't see what I'm writing. If I put adjustPan, the

How to apply Undo and Redo operation to EditText on Button click in android

荒凉一梦 提交于 2019-12-12 15:09:43
问题 I am trying to apply Undo and Redo operation while writing or applying effect to my EditText. For that i have downloaded class from this Link and then i have used it like this in my app. For Undo TextViewUndoRedo mTextViewUndoRedo = new TextViewUndoRedo(edtNoteDescription); mTextViewUndoRedo.undo(); For Redo TextViewUndoRedo mTextViewUndoRedo = new TextViewUndoRedo(edtNoteDescription); mTextViewUndoRedo.redo(); But i don't know why this code does not work, I have put the log and check whether

Android EditText remain hint visible and right-sided

被刻印的时光 ゝ 提交于 2019-12-12 15:09:31
问题 How to make hint in EditText visible during user input and after it? And is it posible to place hint on the right side of EditText control, but user input text - on the left side? Here is an example what I'm looking for: 回答1: So I've found pretty simple solution, a bit tricky, but it works - just to to make relative layout with EditText for input and TextView for hint inside: <RelativeLayout android:orientation="vertical" android:layout_width="fill_parent" android:layout_height="wrap_content"

Reloading fragment, Edittext's text not cleared

99封情书 提交于 2019-12-12 14:57:28
问题 In my fragment there are lot of spinner and edit text and submit button is to save data, reset button is to reset all elements(Edit Texts and Spinners). I have used folllowing code to reset all controls FragmentTransaction ft = getFragmentManager().beginTransaction(); ft.detach(this).attach(this).commit(); but it doesn't clear editext. All spinners are reset but editext's text remain as it is 回答1: detach().detach() not working after support library update 25.1.0 (may be earlier). This

how to avoid soft keyboard showing auto correct suggestion?

自作多情 提交于 2019-12-12 14:42:01
问题 I dont want my softkeyboard show these suggestions and any of the symbols like !, ", ,, :,'. 回答1: To stop offering suggestions, add the following attribute to your EditText in XML: android:inputType="textNoSuggestions" and/or add multiple types using | as below: android:inputType="textNoSuggestions | text" 回答2: You can add this line to you EditText android:inputType="textFilter" See here why it sometimes better than textNoSuggestions 来源: https://stackoverflow.com/questions/11519030/how-to

EditText, OnKeyListener or TextWatcher (barcode scanning)

旧时模样 提交于 2019-12-12 13:13:02
问题 I'm using a barcode scanner which inserts barcode string into an EditText in this format "12345\n". Instead of using a search button, I want to trigger the search event by the "\n" character. I used TextEdit's addTextChangedListener and inside that function I'm doing: protected TextWatcher readBarcode = new TextWatcher() { @Override public void onTextChanged(CharSequence s, int start, int before, int count) { // TODO Auto-generated method stub } @Override public void beforeTextChanged

Android using TextWatcher to replace words

本小妞迷上赌 提交于 2019-12-12 12:15:32
问题 I have an editText , that you write in it something then when u click next .. the text u wrote gets written into another editText .. It's working perfectly .. But I want to use textWatcher to replace some letters.. Example: How do I make the S to be $ or the O to be @ UPDATE: final EditText First = (EditText)findViewById(R.id.etFirst); String strFirst = First.getText().toString(); final TextView done = (TextView)findViewById(R.id.tvName); String strDone = done.getText().toString(); Button