android-input-method

How to add custom InputMethodService to Activity?

我是研究僧i 提交于 2019-12-02 06:09:45
问题 I decided to create a custom keyboard for my application. I know that this is not the best idea, since it's hurting the user friendliness, that's why I will just make it optional in Preferences. After having it all done in a class public class CustomKeyboard extends InputMethodService implements KeyboardView.OnKeyboardActionListener . I struggle to add it as a softInputMethod . I tried with the InputMethodManager but I get incompatible types when casting it. I found that I can get it w/o the

Get pointer to onscreen keyboard view on Android

[亡魂溺海] 提交于 2019-12-02 00:38:19
I am working to tint all UI elements reddish in an astronomy app. I have successfully done this for basically everything except the onscreen keyboard. I need to get a reference to the keyboard's Window or View in order to do this. I have not found anything in the API for doing so. Can anyone suggest a way for me to get hold of this? I have seen postings explaining (a hack for) how to learn when the keyboard is shown or hidden, but not to actually get a reference to the view. Thanks Bill Can anyone suggest a way for me to get hold of this? Write your own input method editor and hope users use

How to change keyboard layout by swipe left or right space key in custom keyboard

故事扮演 提交于 2019-12-01 14:31:47
I made an android custom keyboard . I want to use swiping on Space key on the keyboard for changing keyboard layout to show next language layout. How can i do that? I used bellow class: public class KeyboardIMS extends InputMethodService implements KeyboardView.OnKeyboardActionListener { ...} You can do this by override touchEvent like this : @Override public boolean onTouchEvent(MotionEvent e) { float x = e.getX(); float y = e.getY(); switch (e.getAction()) { case MotionEvent.ACTION_DOWN: mIsDown = true; break; case MotionEvent.ACTION_MOVE: float dx = x - mPreviousX; float dy = y - mPreviousY

How to change keyboard layout by swipe left or right space key in custom keyboard

不打扰是莪最后的温柔 提交于 2019-12-01 12:19:28
问题 I made an android custom keyboard . I want to use swiping on Space key on the keyboard for changing keyboard layout to show next language layout. How can i do that? I used bellow class: public class KeyboardIMS extends InputMethodService implements KeyboardView.OnKeyboardActionListener { ...} 回答1: You can do this by override touchEvent like this : @Override public boolean onTouchEvent(MotionEvent e) { float x = e.getX(); float y = e.getY(); switch (e.getAction()) { case MotionEvent.ACTION

Gboard like search bar in Android IME

你。 提交于 2019-12-01 06:11:31
I want to create a search bar like Gboard inside keyboard (Android IME) as shown in picture. Gboard Sample : I have implemented an edittext on Keyboardview.xml as shown in picture. My Implementation : main_keyboard_frame.xml <RelativeLayout android:layout_width="match_parent" android:layout_height="120dp" android:background="#cf060610" android:id="@+id/search_panel" android:visibility="invisible"> <EditText android:layout_width="match_parent" android:layout_height="40dp" android:hint="sdsddsd" android:id="@+id/ed"/> </RelativeLayout> But the problem is when i press the edittext 2 (that is

Gboard like search bar in Android IME

空扰寡人 提交于 2019-12-01 05:26:18
问题 I want to create a search bar like Gboard inside keyboard (Android IME) as shown in picture. Gboard Sample : I have implemented an edittext on Keyboardview.xml as shown in picture. My Implementation : main_keyboard_frame.xml <RelativeLayout android:layout_width="match_parent" android:layout_height="120dp" android:background="#cf060610" android:id="@+id/search_panel" android:visibility="invisible"> <EditText android:layout_width="match_parent" android:layout_height="40dp" android:hint="sdsddsd

What are the semantics of each InputType constant?

若如初见. 提交于 2019-11-30 21:56:33
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 EditorInfo.TYPE_TEXT_FLAG_MULTI_LINE ). Google's documentation is very vague about the actual effect of

Get specific drawable from state list drawable

℡╲_俬逩灬. 提交于 2019-11-30 19:35:59
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:key_type_topnav="true" android:state_pressed="true" android:drawable="@drawable/tab_down" /> <item kplus

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

落花浮王杯 提交于 2019-11-30 14:43:58
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 that my InputConnection is gone). You can try using a PopupWindow . You'll have to do a bit of hacking to

Android - Get keyboard key press

拥有回忆 提交于 2019-11-30 06:24:56
问题 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)