Tag: android-edittext

Label in a editbox in android

My question is, how to put a label in a editBox in android ? Like for example, i want to put “To:” in editbox of a contact picker which will not get deleted even if I press backspace on the onscreen keyboard. I tried with android:hint, but it gets deleted when the editBox is focus […]

Push up content except some view when keyboard shown

I have a layout that contains 5 EditText and a Button and a TextView at bottom. Now when I press an EditText then the keyboard will shown and all my View is push up. Now I don’t want to push my TextView and Button to above keyboard, just only want to push up all EditText […]

Android – Do something *after* text is changed in EditText

I build an android application. I have an EditText. I want to save changes (or anything else) automatically after the user change the text. Now I use editText.addTextChangedListener(textWatcher); and TextWatcher textWatcher = new TextWatcher() { public void afterTextChanged(Editable s) { … } But it saves the changes after every little change (add \ remove a […]

Declare EditText as TextView in Android

i have a xml layout main.xml like this <?xml version=”1.0″ encoding=”utf-8″?> <RelativeLayout xmlns:android=”http://schemas.android.com/apk/res/android” android:layout_width=”wrap_content” android:layout_height=”fill_parent” android:gravity=”center” > <EditText android:layout_width=”fill_parent” android:layout_height=”wrap_content” android:text=”text” android:textColor=”#000″ android:textSize=”16dp” android:id=”@+id/edtxt” android:gravity=”center|top|left”/> </RelativeLayout> and i declare this in my activity like this public class MyActivity extends Activity { private TextView txt = null; @Override public void onCreate(Bundle savedInstanceState) { super.onCreate(savedInstanceState); setContentView(R.layout.main); txt= […]

How to dynamically set layout parameters in Android?

I have these text fields which I generated dynamically. But I can’t seem to set layout parameters for them. Please tell me what I’m doing wrong. I’m able to generate the fields without layout parameters. However, If I use LayoutParams, it doesn’t even get generated. Code: TableLayout table = (TableLayout) findViewById(R.id.TableLayout1); TableRow tr = new […]

Customize Edittext input character to image?

I want to customize an edittext when user input a character and then edittext changes it to image. Look like the image : Note : ‚óŹ is an image not a symbol.

Catching key pressed with the virtual keyboard in Android?

With the physical keyboard you can catch key presses with a KeyListener, something like: myEditText.setOnKeyListener(new OnKeyListener() { @Override public boolean onKey(View v, int keyCode, KeyEvent event) { if (keyCode == KeyEvent.KEYCODE_ENTER) { /* do something */ } } }); Does anyone know how to do this (or similar) with the virtual keyboard?

Android Edittext- Clearing Spans

I am trying to get an EditText to clear its spans by calling EditText.getText().clearSpans(). However, if I call this method, the EditText starts to behave strangely, with line feeds appearing as boxes and any spans I then set being in completely the wrong place. So my question is: How do I clear spans from and […]

EditText: Disable Paste/Replace menu pop-up on Text Selection Handler click event

My goal is to have an EditText that has no fancy features, just the Text Selection Handler for moving the cursor more easily — so no context menus or pop-ups. I’ve disabled the appearance of the text editing function actionbar (copy/Paste etc.) by consuming the ActionMode Callback event, as per this solution. The middle Middle […]

Keyboard suggestions cause part of Android EditText.setError() message to not display

When I’m using edittext.setError(“enter a comment”) in android, it works fine until the keyboard suggestions come up and the error gets pushed above the edittext, after which it does not display the whole error message. Why is it doing this?

Android Babe is a Google Android Fan, All about Android Phones, Android Wear, Android Dev and Android Games Apps and so on.