android-edittext

How to capitalize every letter in an Android EditText?

假如想象 提交于 2019-12-30 07:56:12
问题 I have an array of editTexts which I make like this: inputs[i] = new EditText(this); inputs[i].setWidth(376); inputs[i].setInputType(InputType.TYPE_TEXT_FLAG_CAP_CHARACTERS); tFields.addView(inputs[i]); I want every character to be capitalized. Right now, the first letter of the first word is lowercase, then all the characters afterwords are upper case. I can take what the user inputs after they are done and convert that to uppercase, but that's not really what I'm going for. Is there a way

How to capitalize every letter in an Android EditText?

人盡茶涼 提交于 2019-12-30 07:56:07
问题 I have an array of editTexts which I make like this: inputs[i] = new EditText(this); inputs[i].setWidth(376); inputs[i].setInputType(InputType.TYPE_TEXT_FLAG_CAP_CHARACTERS); tFields.addView(inputs[i]); I want every character to be capitalized. Right now, the first letter of the first word is lowercase, then all the characters afterwords are upper case. I can take what the user inputs after they are done and convert that to uppercase, but that's not really what I'm going for. Is there a way

requestFocus not working

…衆ロ難τιáo~ 提交于 2019-12-30 04:32:06
问题 <RelativeLayout xmlns:android="http://schemas.android.com/apk/res/android" android:layout_width="fill_parent" android:layout_height="fill_parent" android:padding="20dp" > <AutoCompleteTextView android:id="@+id/autocomplete_zone" android:layout_width="fill_parent" android:layout_height="wrap_content" android:layout_centerHorizontal="true" android:dropDownVerticalOffset="0.2dp" android:ems="10" android:hint="@string/zone_hint" android:inputType="text" android:lines="1" android:maxLines="1"

Android execute function after pressing “Enter” for EditText

五迷三道 提交于 2019-12-30 04:15:11
问题 I have been following the official Android tutorials and somehow am having a problem with this very simple example to execute a function after pressing "Enter" for an EditText. I understand what I'm supposed to do and seem to have everything setup properly, but Eclipse is complaining with this line: edittext.setOnKeyListener(new OnKeyListener() { It underlines setOnKeyListener with the error: The method setOnKeyListener(View.OnKeyListener) in the type View is not applicable for the arguments

Can't manage to requestFocus a Spinner

早过忘川 提交于 2019-12-30 03:07:25
问题 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 cannot make the top Spinner start focused, either by using <requestFocus/> in the screen XML, or by using requestFocus() in code. I've attempted to do what requestFocus skipping next EditText suggests,

How do I position the cursor on the right in EditText

只谈情不闲聊 提交于 2019-12-30 02:45:13
问题 My application uses RTL language (right to left). When the EditText field gets focus, the cursor appears on the left and only when the user starts to type, the cursor (and the RTL text) moves right. When the user clicks "enter" to start a new line, the cursor moves to the left again. When I use android:gravity="right" , the cursor is OK (on the right) but as the user starts to type the text always moves to the the other side (RTL text moves left). Any ideas how I can align text to the right

PopupWindow not triggering sytem context dialog on EditText long-press

偶尔善良 提交于 2019-12-29 09:15:07
问题 Sorry if the title was a bit vague. I'm developing an app on Freelancer and I almost have it finished except for a complaint from the customer after some testing. I use a PopupWindow in place of a dialog to edit contextual settings, if that makes any sense. I don't want to be too specific and risk giving the app concept away, which I'm sure the customer wouldn't be too pleased about. The PopupWindow is given a Content View of a layout inflated from XML. In that layout are several EditText

How can I get EditText change?

随声附和 提交于 2019-12-29 08:45:10
问题 I have a EditText and I want to inform each time text changes (with entering each character). What implementation should I use and what function should I override? 回答1: Use the addTextChangedListener method on your EditText and make your class implement or define an inner class implementing the TextWatcher class: https://developer.android.com/reference/android/widget/TextView.html#addTextChangedListener(android.text.TextWatcher) 回答2: You can declare a boolean variable as false and at each

EditText Loses Focus on Click

☆樱花仙子☆ 提交于 2019-12-29 07:06:21
问题 I'm writing an activity to list a bunch of items from the database and show an additional column with a quantity. I implemented an ArrayAdapter to show my custom layout. Here is the code of the most important parts of the Adapter: static class ViewHolder { protected TextView text; protected EditText editText; } @Override public View getView(int position, View convertView, ViewGroup parent) { View view = null; if (convertView == null) { LayoutInflater inflator = context.getLayoutInflater();

Issues focusing EditTexts in a ListView (Android)

半世苍凉 提交于 2019-12-29 07:03:03
问题 I have a ListView with a few EditTexts in each item. I have no issues with a hardware keyboard, but things freak out a bit with the soft keyboard. I have two issues. When I first click on an EditText, it briefly appears to have focus but then loses focus once the keyboard has shown. I must then click the EditText again to get focus. When an EditText with focus is scrolled out of view, focus goes to... well... see the screenshot. I'm not sure what's happening. More details on #1: When the