Tag: android-edittext

EditText not automatically saved on screen orientation change

I read that Android automatically saves the content of EditText objects when an application is about to be stopped or killed. However, in my app the content of an EditText is lost when screen orientation changes. Is it normal behaviour? Do I then have to manually save/restore its content with onSaveInstanceState/onRestoreInstanceState? Or is there an […]

Android – Adjust screen when keyboard pops up?

I want to be able to adjust my UI screen on Android when the soft keyboard pops up. So at the minute I have something similiar to the first picture below where I have and EditText at the bottom of the screen and when a user taps the EditText I want the same as what […]

Remove filter from EditText in Android?

It is possible to add filters in Android by doing something like this to add a 3 char limit to the field: editText.setFilters(new InputFilter[] { new InputFilter.LengthFilter(3) }); What about removing an already set filter though? My problem is I will be switching between a 3 and 4 character max length on the field depending […]

Can't disable predictive text

I’m trying to disable predictive text for a given EditText, as explained here, but I still get the autocomplete by the prediction… I’ve got a Samsung Galaxy S with XT9 enabled. Anybody can help? <EditText android:id=”@+id/search_field” android:layout_width=”300dp” android:layout_height=”27dp” android:background=”@drawable/bg_searchfield” android:hint=”@string/search_hint” android:imeOptions=”actionSearch” android:inputType=”text|textNoSuggestions|textFilter”/>

OnEditorActionListener not working

I simply want to catch the event when the user press enter on an editText. I did not get the Toast message, not the “Enter pressed” and not the “Some key pressed!” either. What m i doing wrong? myEditText.setOnEditorActionListener(new OnEditorActionListener() { @Override public boolean onEditorAction(TextView v, int actionId, KeyEvent event) { Toast.makeText(getApplicationContext(), “Some key pressed!”, […]

Scrolling EditText inside ScrollView

I have a nasty problem. I have EditText(8 lines) inside ScrollView. And when I’m trying to scroll text in EditText it’s behavior is not stable. Sometimes it’s scrolling, some times it’s not taking focus. This is my layout file, to make my question more clear: <LinearLayout android:layout_width=”match_parent” android:layout_height=”wrap_content” android:orientation=”vertical” android:padding=”8dp” > <TextView android:id=”@+id/wo_task_name” android:layout_width=”wrap_content” android:layout_height=”wrap_content” […]

Android: Issues in animating edittext?

I tried to animate the edittext when user starts editing it. I have tried the following code, EditText txtPassword = (EditText) findViewById(R.id.editText1); Animation anim = AnimationUtils.loadAnimation(getApplicationContext(),R.anim.anim); anim.setInterpolator((new AccelerateDecelerateInterpolator())); anim.setFillAfter(true); txtPassword.startAnimation(anim); anim.xml ““““ <?xml version=”1.0″ encoding=”utf-8″?> <set xmlns:android=”http://schemas.android.com/apk/res/android”> <translate android:fromYDelta=”0″ android:toYDelta=”-50%p” android:duration=”100″/> </set> The animation works fine. but the edittext stopped userinteraction after animation. If the […]

How do I set multiple input types in an EditText on Android?

I am trying to create an EditText with auto-capitalization and auto-correction implemented. I have manually figured out how to add InputFilters to allow auto-capitalization, though this only works after the first letter is typed, and I have had no luck with auto correction (I tried to create an InputFilter that used AutoText, but I’m not […]

After type in EditText, how to make keyboard disappear

From the android tutorial : pass_text.setOnKeyListener(new OnKeyListener() { public boolean onKey(View v, int keyCode, KeyEvent event) { // If the event is a key-down event on the “enter” button if ((event.getAction() == KeyEvent.ACTION_DOWN) && (keyCode == KeyEvent.KEYCODE_ENTER)) { // Perform action on key press return true; } return false; } }); } when click at […]

Making EditText and Button same height in Android

i have an EditText and a Button in my LinearLayout and i want to align them closely together so they see seem to belong together (edittext + micButton for speech input). Now they don’t have the same height and they aren’t really aligned well (button seems to be a little lower than the EditText). I […]

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