android-edittext

Looping through editTexts to check values

和自甴很熟 提交于 2019-12-02 18:24:17
问题 I have one layout with 100 blank EditTexts, all named based on their row / column IDs (e.g. box0101, box0102 etc.). I then have another layout with 100 TextViews in exactly the same layout with one letter in each, named using the same convention (answerbox0101, answerbox0102 etc.) I want to write a loop that checks box0101 against answerbox0101, and so on until either one of the boxes does not match up, or it gets to 100 and all the boxes match. I am fine with writing the logic of the loop,

How to change the default disabled EditText's style?

…衆ロ難τιáo~ 提交于 2019-12-02 18:16:43
It isn't looking nice when using EditText enabled="false". How can I change it automatically for all of the controls? I've added this image for reference. Can someone help me? Thanks. In the color file define your color: <?xml version="1.0" encoding="utf-8"?> <selector xmlns:android="http://schemas.android.com/apk/res/android"> <item android:state_enabled="false" android:color="@color/disabled_color" /> <item android:color="@color/normal_color"/> </selector> In the layout: <EditText android:text="whatever text you want" android:layout_width="wrap_content" android:layout_height="wrap_content"

EditText loses focus when keyboard appears; requires touching twice to edit

帅比萌擦擦* 提交于 2019-12-02 18:00:32
I have been designing an application which holds an expandable list. At the end of every list, an empty EditText is ready to receive comments. I have the following problem; when I touch the EditText , the screen resizes slightly (not a problem as the resizing does not always happen, depending on my layout and the position of the EditText int he list) and the soft-keyboard appears. However, during these events, the EditText loses focus and does not regain it. This is quite inconvenient as without focus, despite the keyboard being available, the input from the keyboard does not reach the

Android Capitalize characters not working in phone

久未见 提交于 2019-12-02 17:54:30
问题 in my app, I want to allow the user to enter only upper case letters. So I used capitalize property. This is one part of code <EditText android:id="@+id/et5" android:layout_width="140dp" android:layout_height="wrap_content" android:layout_x="127dp" android:layout_y="219dp" android:maxLength="25" android:ems="10" android:singleLine="true" android:capitalize="characters" android:text="" /> In some cases I also tried this android:inputType="textCapCharacters" It works fine in emulator, But it is

Android OS bug with some devices running Jelly Bean/4.2.1 - TextView.setError(CharSequence error) Missing icon

倖福魔咒の 提交于 2019-12-02 17:27:27
Some, but not all, devices running Jelly Bean (4.2.1) appear to be missing the exclamation point error icon that should appear on a TextView (or, more commonly, an EditText ) that has an error set on it via TextView.setError(CharSequence error) . The Galaxy Nexus definitely seems to be missing the icon. The effect is that the error status set by setError is only apparent when the EditText has focus. This makes setError(...) much less useful as it's often used to encourage users to return to that EditText to fix a problem. E.g., you have a standard login screen with username and password form

How to clear focus for EditText?

廉价感情. 提交于 2019-12-02 17:16:52
I have an activity with a search box ( EditText ) on the top, and a ListView below. Whenever the activity starts, the EditText always has focus and bring up the keyboard which partially cover the ListView . There's no other text view that can have focus. I want the EditText to have focus ONLY when the user touches it and start typing. I try to put clearFocus() in onCreateView , onViewCreated or onCreated , but no luck. Set in your parent layout next attributes: <RelativeLayout xmlns:android="http://schemas.android.com/apk/res/android" android:id="@+id/mainLayout" android:descendantFocusability

Detect if content of EditText was changed by user or programmatically?

丶灬走出姿态 提交于 2019-12-02 16:58:50
I would need a way to detect if the EditText has been changed by the user typing something or by the app changing the text programmatically. Any standard way of doing this? I guess I could always do something hackish like unsetting the TextWatcher before setText() and setting it back again afterwards, but there's got to be a better way of doing this... right? I tried checking if the EditText is focused in the TextWatcher, but that was of little help since the EditTexts gets focused "semi-randomly" anyway when scrolling... Background I have a ListView with EditTexts in every listitem. I've

Show the password with EditText

我们两清 提交于 2019-12-02 16:16:48
I use an EditText to enter password. And a CheckBox to show password or not. Below function is the part: public void ShowPassword() { if (cb.isChecked()) { password.setInputType(InputType.TYPE_TEXT_VARIATION_VISIBLE_PASSWORD); } else { password.setInputType(InputType.TYPE_TEXT_VARIATION_PASSWORD); } } When it checked, it show password. But when it not checked, it does show stars. How to modify it to show star while the cb is not checked? I don't know exactly the specifics, but this code should work: checkbox.setOnCheckedChangeListener(new OnCheckedChangeListener() { @Override public void

How do I prevent an EditText from resizing itself when the user is typing?

亡梦爱人 提交于 2019-12-02 15:44:24
I have an EditText and a Button set next to each other on the same horizontal line. It looks great, except when the user enters a lot of text, the EditText is resized, and the Button is squished. I have both EditText and Button set to layout_width="wrap_content" . "fill_parent" messes up the layout, and I don't want to use absolute sizes if I don't have to - the way it is now looks great in both landscape and portrait, I just don't want the EditText to resize. My layout: <TableLayout android:id="@+id/homelayout" android:layout_width="fill_parent" android:layout_height="fill_parent" > <TableRow

How can I do something, 0.5 second after text changed in my EditText?

核能气质少年 提交于 2019-12-02 15:22:14
I am filtering my list using an EditText. I want to filter the list 0.5 second after user has finished typing in EditText . I used the afterTextChanged event of TextWatcher for this purpose. But this event rises for each character changes in EditText. What should I do? Berťák editText.addTextChangedListener( new TextWatcher() { @Override public void onTextChanged(CharSequence s, int start, int before, int count) { } @Override public void beforeTextChanged(CharSequence s, int start, int count, int after) { } private Timer timer=new Timer(); private final long DELAY = 1000; // milliseconds