android-input-method

What are the semantics of each InputType constant?

自作多情 提交于 2019-11-30 04:43:41
问题 You can set a TextView 's inputType to one of the values from InputType to hint that the typed-in text should be a person's name, phone number, &c. Even if the input method doesn't respect this hint, the TextView uses a KeyListener and/or TransformationMethod to ensure that only relevant characters can be entered, or to have effects like masking the password. Even the flags are more than just hints: they can change the behaviour of the TextView significantly (the most obvious example being

Get specific drawable from state list drawable

我是研究僧i 提交于 2019-11-30 02:56:21
问题 I have a state list drawable, and i want to get a specific drawable from the state list drawable: <?xml version="1.0" encoding="utf-8"?> <selector xmlns:android="http://schemas.android.com/apk/res/android" xmlns:kplus="http://schemas.android.com/apk/res-auto"> <item kplus:key_type_space_alt="true" android:state_pressed="true" android:drawable="@drawable/space_1_pressed" /> <item kplus:key_type_space_alt="true" android:drawable="@drawable/space_1_normal" /> <!-- TopNav keys. --> <item kplus

Android IME: showing a custom pop-up dialog (like Swype keyboard) which can enter text into the TextView

試著忘記壹切 提交于 2019-11-29 22:25:38
问题 I'm wondering how I can create a custom pop-up like the one in the screenshot below (borrowed from the Swype keyboard), where I can have a couple of buttons, which each commit a string to the currently "connected" TextView (via a InputConnection). Please note: this is an InputMethodService and not an ordinary Activity . I already tried launching a separate Activity with Theme:Dialog . However, as soon as that one opens I lose my focus with the TextView and my keyboard disappears (and with

Softkeyboard not showing in AlertDialog for phone only

China☆狼群 提交于 2019-11-29 16:11:18
Why the softkeyboard is showing only on the tablet is a mystery ! Here is the code that I have used. AlertDialog.Builder builder = new AlertDialog.Builder(CurrentActivityName.this); builder.setTitle(“Title”); builder.setMessage(“Message”); final EditText input = new EditText(CurrentActivityName.this); builder.setView(input); builder.setPositiveButton(R.string.allow, new DialogInterface.OnClickListener() { @Override public void onClick(DialogInterface dialog, int which) { //my code } }); builder.setNegativeButton(R.string.cancel, new DialogInterface.OnClickListener() { @Override public void

View-specific IME?

我怕爱的太早我们不能终老 提交于 2019-11-29 11:55:38
I have a custom view for which I want the user to be able to enter characters from an app-defined set of characters. To do this, as I understand it, I need to write an input method service. The user not only needs to install it, but then needs to enable the IME in the Settings > Language & keyboard, and then select the custom IME for use in the view. This seems really crazy. I want this IME to be used for just one view in one application. I don't want it to be available system-wide or force the user to make global setting changes. The only alternative I can see is defining my own in-app custom

Need number only soft keyboard?

Deadly 提交于 2019-11-29 09:29:13
Hi I need a soft keyboard with only numeric values 0 to 9 and Enter key. Shouldn't show anything other than these like . , ( ) etc... I tried several options as suggested here but nothings seems to work for me. setRawInputType(Configuration.KEYBOARD_QWERTY) setRawInputType(InputType.TYPE_CLASS_NUMBER | InputType.TYPE_NUMBER_FLAG_SIGNED) setRawInputType(InputType.TYPE_CLASS_NUMBER) setRawInputType(InputType.TYPE_CLASS_PHONE) I always have the extra characters show up on the keyboard like: setRawInputType(Configuration.KEYBOARD_12KEY) shows a keyboard like this: Would appreciate any help. Thanks

Android custom keyboard popup keyboard on long press

瘦欲@ 提交于 2019-11-28 18:22:59
I have custom Android keyboard: public class CustomKeyboard extends Keyboard{...} public class CustomKeyboardView extends KeyboardView{...} public class CustomKeyboardIME extends InputMethodService implements KeyboardView.OnKeyboardActionListener{...} On some keys, I have popupKeyboard and popupCharacters : <Key android:codes="144" android:keyLabel="0" android:popupKeyboard="@xml/key_popup" android:popupCharacters=")" android:keyEdgeFlags="right"/> xml/key_popup.xml: <Keyboard xmlns:android="http://schemas.android.com/apk/res/android" android:keyWidth="10%p" android:horizontalGap="0px" android

Android - Get keyboard key press

早过忘川 提交于 2019-11-28 18:17:55
I want to catch the press of any key of the softkeyboard. I don't want a EditView or TextView in my Activity, the event must be handled from a extended View inside my Activity. I just tried this: 1) Override the onKeyUp(int keyCode, KeyEvent event) Activity method. This don't work with softkeyboard, it just catch few hardkeyboard. 2) Create my OnKeyListener and register that in my View that contains a registered and working OnTouchListener . This doesn't work at all with softkeyboard. 3) Override the onKeyUp(int keyCode, KeyEvent event) View method. This not work at all neither if I set my

How can I tell if the input method picker is open or closed?

落爺英雄遲暮 提交于 2019-11-28 03:03:22
问题 My app opens the input method picker (the menu where you choose a keyboard) with InputMethodManager.showInputMethodPicker() . My app doesn't actually create the picker (it's created by InputMethodManager) but I know it's a ContextMenu and its id is R.id.switchInputMethod . The picker is part of a multi-step wizard so I need to know when the picker closes so my app can proceed to the next step. Right now I'm checking in a background thread if the default keyboard changed, but that doesn't help

Need number only soft keyboard?

三世轮回 提交于 2019-11-28 02:57:59
问题 Hi I need a soft keyboard with only numeric values 0 to 9 and Enter key. Shouldn't show anything other than these like . , ( ) etc... I tried several options as suggested here but nothings seems to work for me. setRawInputType(Configuration.KEYBOARD_QWERTY) setRawInputType(InputType.TYPE_CLASS_NUMBER | InputType.TYPE_NUMBER_FLAG_SIGNED) setRawInputType(InputType.TYPE_CLASS_NUMBER) setRawInputType(InputType.TYPE_CLASS_PHONE) I always have the extra characters show up on the keyboard like: