Tag: android-edittext

How to limit EditText to input only float values in Java?

I have found answers to limit it to Integer/float in xml, I want to do it programmatically. I can set setInputType(InputType.TYPE_CLASS_NUMBER) for integer values, but what for float values? I want them in xxxx.xxx format.

Android – Keyboard not appearing in floating window

I’m writing an application that uses the following code to draw an edittext on the screen over running applications: WindowManager.LayoutParams params = new WindowManager.LayoutParams( WindowManager.LayoutParams.WRAP_CONTENT, WindowManager.LayoutParams.WRAP_CONTENT, WindowManager.LayoutParams.TYPE_PHONE, WindowManager.LayoutParams.FLAG_NOT_FOCUSABLE | WindowManager.LayoutParams.FLAG_ALT_FOCUSABLE_IM, PixelFormat.TRANSLUCENT); windowManager = (WindowManager) getSystemService(WINDOW_SERVICE); windowManager.addView(mEditText, params); The xml for the edittext is: <EditText android:id=”@+id/mEditText” android:layout_width=”match_parent” android:layout_height=”wrap_content” android:maxLines=”3″ android:inputType=”textAutoComplete|text” android:focusable=”true” android:focusableInTouchMode=”true” /> However focusing on […]

Soft Keyboard Overlapping with EditText Field

I found this old post which definitely helps with my problem, but I’m noticing that it doesn’t really seem to solve my problem. I have gathered that I need to set android:windowSoftInputMode=”adjustPan” for my activity. But the issue is that it simply doesn’t pan ENOUGH. The text field is toward the bottom of the view, […]

Set Image on Left side of EditText in Android

I am having one contact form in which I would like to add some icons to my edit text for a better look. I want to create EditText something like below. I have EditText like below. And I got the result something like. I want the image to be absolutely on the left side as […]

EditText automatically go to a new line

I want to make the EditText with max lines of 2 and max length of 20. If the EditText length is more than 10, it should automatically go to a new line so the user don’t need to press Enter. Can someone help me with this requirement?

Setting up EditText with “url” inputType

I am trying to make an EditText such that when i click it a key board containing “.com” appears because a url is to be intered into the EditText. I tried to use this: android:inputType=”textUri” but it is not working. How do i do it?

Clickable Button (or any View) inside EditText in android

I want to have a Button or a clickable View in my EditText so that I can perform some action on click of it. I was able to put a drawable inside my EditText thanks to Marcosbeirigo for this answer. But, now I want to make it clickable so that I can perform some action […]

How to make multiline edittext in android

I try to create an edittext dynamically with LayoutParams.MATCHPARENT for its both width and height. I have tried the following code, but it is still not working. EditText editor = ….; LayoutParams params = new LinearLayout.LayoutParams(LayoutParams.MATCH_PARENT, LayoutParams.MATCH_PARENT, 1); editor.setLayoutParams(params); editor.setGravity(Gravity.LEFT | Gravity.TOP); editor.setBackgroundColor(Color.WHITE); editor.setImeOptions(EditorInfo.IME_FLAG_NO_EXTRACT_UI); editor.setTextColor(Color.BLACK); //editor.setSingleLine(false); editor.setFocusableInTouchMode(true); editor.setInputType(EditorInfo.TYPE_CLASS_TEXT | EditorInfo.TYPE_TEXT_FLAG_MULTI_LINE | EditorInfo.TYPE_TEXT_FLAG_IME_MULTI_LINE); editor.setMaxLines(Integer.MAX_VALUE); editor.setHorizontallyScrolling(false); editor.setTransformationMethod(null); […]

Can't type in editText on Mac emulator

I am a new Mac OS user and I transfered my Android project to Mac after installing Eclipse and all the necessary requirments. My application is running normally, but I can’t seem to type in the emulator. I am running an Android 4.1 emulator using Eclipse Juno.

Can't manage to requestFocus a Spinner

I’ve got an annoying issue with a screen. The screen consists of a bunch of Spinners one under the other, and then underneath the spinner, an EditText. The problem is that when the screen starts, the EditText has focus, meaning that some Spinners are off the top of the screen. Try as I might, I […]

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