Tag: android-edittext

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 […]

EditText hint disappears with gravity

I have seen many similar questions to this one but I think this still covers new ground: 1) Hint text disappears when you set gravity 2) android:ellipsize=”start” fixes that so you can have centered hints and centered text 3) why does the code below still show centered hint text? <EditText android:id=”@+id/details” android:layout_width=”fill_parent” android:layout_height=”wrap_content” android:gravity=”center” android:hint=”use […]

Having a EditText over a soft keyboard with a GL View in the background programmatically

I am working on a game and I want an EditText position above the soft keyboard when it pops up. Here is what my code looks like when I build the View Hierarchy in my Main Activity: getWindow().addFlags(WindowManager.LayoutParams.FLAG_LAYOUT_IN_SCREEN | WindowManager.LayoutParams.FLAG_LAYOUT_NO_LIMITS); viewGroup = new RelativeLayout(this); viewGroup.setLayoutParams(new ViewGroup.LayoutParams(LayoutParams.MATCH_PARENT, LayoutParams.MATCH_PARENT)); view = new GameView(this); RelativeLayout.LayoutParams vLayoutParams = new […]

Android: only show cursor in edittext when keyboard is displayed

how can I only show the cursor of an EditText when the keyboard is displayed. At the moment the cursor is blinking even if the EditText is not active and the keyboard is hidden, which is really annoying. This is how my layout looks: <?xml version=”1.0″ encoding=”utf-8″?> <RelativeLayout xmlns:android=”http://schemas.android.com/apk/res/android” android:id=”@+id/activity_main_root” android:layout_width=”match_parent” android:layout_height=”match_parent” android:background=”@color/white” > <ImageButton […]

ActionNext does not work with multiline EditText in android

I have multiple multi-line EditText in my layout with ImeOptions set to ActionNext. But the android keypad does not show Next button. When I remove textMultiLine from inputType, then Next button appears. How to achieve it with multiline EditText?

Is there a way to detect the word tapped in an EditText

Is there any way to map characters to a pixel location in an EditText? I assume there is some knowledge within the component of the word at any pixel location, because you can select a word for copy and paste operations. Also, most of the popular browsers and book readers have some sort of lookup […]

How to change the text color of the error popup for an EditText?

On ICS, when using a theme based upon android:Theme.Light the text in the error popup when using setError(…) is white, as is the background. I can fix this issue by adding <item name=”android:textColorPrimaryInverse”>#ff000000</item> to my theme. While this helps I’m a bit worried that by doing that change some other text, that uses textColorPrimaryInverse will […]

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