Tag: android-edittext

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

EditText: Avoid getting focus on setText()

I have an activity with a scrollview containing some buttons and a EditText So the buttons are above the EditText component. By clicking on a Button the EditText component change his text value by using EditText.setText(“foo”); Unfortunately this call will set the focus to the EditText component, so the ScrollView will scroll to the EditText […]

Android accessibility in edit text with hint

I have edittext for entering first name when creating account and its hint is “Jane”(as first name). I also want to have content description on this edittext for accessibility saying “first name”. When I set both hint and content description warning pops up “Do not set both contentDescription and hint: the contentDescription will mask the […]

ClearableEditText – requestLayout() improperly called on Android 4.3

I implemented ClearableEdittext and it works perfectly except on 4.3 where the logcat floods me with: W/View(16611): requestLayout() improperly called by com.[myPackage].ui.widgets.ClearableEditText{42233dd0 VFED..CL .F….ID 0,0-708,88 #7f050127 app:id/SearchEdittext} during layout: running second layout pass W/View(16611): requestLayout() improperly called by com.[myPackage].ui.widgets.ClearableEditText{42233dd0 VFED..CL .F….ID 0,0-708,88 #7f050127 app:id/SearchEdittext} during layout: running second layout pass W/View(16611): requestLayout() improperly called by […]

Android EditText Multiline with SoftInputMode adjustPan

I have an activity to edit some text with a top bar a EditText view in multiline mode inside a scrollview. At the bottom another view with 2 buttons. What I wanted to achieve is when editing the text that bottom bar would be below the softkeyboard. That is easy using android:windowSoftInputMode=”adjustPan” in the manifest. […]

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