android-edittext

How can I set my enum with the value the user enter in a EditText?

风格不统一 提交于 2019-12-11 17:44:09
问题 I have a editText where the users enter a number between 0 and 10. Depending on their entered number the enum (knowledge) will set. Here's my code so far: public int fromUserInput() { TextView eWissen = (TextView) findViewById(R.id.editText_eingabeWissentsstand); eWissen.getText().toString() == Zahl; return Zahl; } private enum Wissenstand { BEGINNER, FORTGESCHRITTENER, PRO, GRANDMASTER; static Wissenstand fromUserInput(final int input) { if (input >= 10) { return GRANDMASTER; } else if

Android accessibility in Edit text box text not reading properly/Expect After Talk back on

拟墨画扇 提交于 2019-12-11 17:39:52
问题 I am creating app for blind people. there, when blind people after entered the zip code on that profile registration Edit Text box, like 45987. It reading as Fourty Five Thousand and Nine hundred eighty seven. But, I want to read an Four Five Nine Eight Seven. 4 5 9 8 7. Note: when i tried for the same in TexView, its reading as correctly. only problem with EditText. My Sample Code: zipCode_EditText.setContentDescription("4 5 9 8 7"); I have referred these link: Android Acccessibility: How do

java.lang.NoClassDefFoundError: Failed resolution of: Landroid/support/v4/view/KeyEventCompat

泄露秘密 提交于 2019-12-11 17:32:12
问题 I am going to enter a phone number, but when I type in the number, the app crash immediately. The following error occurred E/AndroidRuntime: FATAL EXCEPTION: main Process: com.xbdl.dmtoilet, PID: 3155 java.lang.NoClassDefFoundError: Failed resolution of: Landroid/support/v4/view/KeyEventCompat; at android.support.v7.app.AppCompatActivity.dispatchKeyEvent(AppCompatActivity.java:526) at android.support.v7.view.WindowCallbackWrapper.dispatchKeyEvent(WindowCallbackWrapper.java:59) at android

why underline is removed by changing the style of font?

百般思念 提交于 2019-12-11 17:25:42
问题 I'm a beginner in android ,so please do excuse me if my question is foolish.Basically I'm trying to make a text editor so after a lot of try I'm able to add the bold , italic , bold-italic styles to text without any problem. But now when I'm trying to add underline to text underline is added without any error but when I'm changing the style for ex- bold to bold-italic then the underline is removed from last underlined charecters[ ][See here underline is there below bold text] [ ][Now

Making not editable EditText component [duplicate]

夙愿已清 提交于 2019-12-11 17:17:16
问题 This question already has answers here : Can we have uneditable text in edittext (3 answers) Closed 6 years ago . I have an edit text. How can I make it non editable from the code. By giving the tag android:editable we can do in the layout.. But I need to do it in the code...Pls Help 回答1: I believe it is as simple as editText.setEnabled(false); 回答2: Refer EDITTEXT edt.setClickable(false); edt.setFocusable(false); ***Layout*** <EditText android:id="@+id/edt" android:layout_width="200px"

Delete entire ImageSpan when the part of it is deleted

非 Y 不嫁゛ 提交于 2019-12-11 17:16:43
问题 I'm trying to implement Emoji's in my app and I should use short codes (like :dog: , :cat: ), not unicode. I have two devices to test on and two different behaviours of EditText and ImageSpan in it. First: Meizu PRO 6, Android 6.0 (API 23) Everything works as I want. When you tap backspace on the spanned text, it disappears from EditText completely, because full spanned part of the string was removed. For example, you have a "Hello :dog: " in your EditText ( :dog: is replaced with a picture

Calling the builtin Undo functionality of EditText by sending Ctrl+Z

浪子不回头ぞ 提交于 2019-12-11 16:53:38
问题 I'm trying to execute the builtin Undo functionality of Android EditText (via TextView) by sending Ctrl+Z : public static KeyEvent keyEvent(int keycode, int metaState) { final long currentTime = System.currentTimeMillis(); return new KeyEvent(currentTime, currentTime, KeyEvent.ACTION_DOWN, keycode, 0, metaState); } mEditText.dispatchKeyEvent(keyEvent(KeyEvent.KEYCODE_Z, KeyEvent.META_CTRL_ON | KeyEvent.META_CTRL_LEFT_ON)); However, it does not work (doesn't do anything). If I connect a

Custom bullet in editText inputType password

丶灬走出姿态 提交于 2019-12-11 16:52:40
问题 I need to create custom bullet for password for editText and put some padding between bullet symbols. Is there some way to do this? 回答1: For changing the character that is displayed you can call the method setTransformationMethod (TransformationMethod method) and pass it a custom PasswordTransformationMethod. This could look something like the following: public class AsteriskPasswordTransformationMethod extends PasswordTransformationMethod { @Override public CharSequence getTransformation

Android: Stop EditText from going outside of tablerow

六眼飞鱼酱① 提交于 2019-12-11 16:50:09
问题 So i have a tablelayout in android with some table rows. In each row i have a textview and an edittext. My setup looks like: <TableLayout android:layout_width="fill_parent" android:layout_height="wrap_content" android:paddingLeft="5dp" android:paddingRight="5dp" android:paddingTop="10dp" android:stretchColumns="3" > <TableRow android:id="@+id/tableRow1" android:layout_width="wrap_content" android:layout_marginBottom="5dp" android:paddingTop="5dp" android:paddingBottom="5dp" android

how to remove android edit text focus when it is disabled?

最后都变了- 提交于 2019-12-11 16:37:36
问题 In small devices soft keyboard's "NEXT " button is used to enter the value for edit texts without touching the edit text. This is very helpful when multiple entry is to be filled.. But i disabled two edit text in between so i can't go beyond that edit text. the next key hides... i used android:imeOptions="actionUnspecified" for those two edit texts but no luck... Any solution? 回答1: Have you tried to set them to be non-focusable? Programmatically (ie when you're deactivating the EditTexts):