Is it possible to change the size of a keyboard view? The default setting of a keyboard will span across the screen, but is it possible to resize a keyboard? (e.g. make the keyboard only take half of the screen?)
No, not unless you create a custom keyboard and ask users to install it as well.
Related
I have two EditText in my layout, and another layout that contains a custom designed keyboard using ImageButtons. Using these two layouts, I want to:
When the EditText is clicked/touched, hide the default keyboard.
Display the custom keyboard (like a replacement to the default keyboard).
Hide the keyboard after clicking back/return key.
I was able to hide the default keyboard by setting the InputType of the two EditText to NULL. However, it means that the cursor will no longer be visible when EditText is focused. This is part of the specifications of the project.
How do I best approach this problem? What could be a best solution?
Edit: Project specifications were changed. However, I would still love to have the solution or approach to this problem / issue. Thank you very much.
I have an Android app where layout elements size and margins are defined in dimens files (e.g, values-hdpi/dimens.xml, value-xhdpi/dimens.xml, etc.). That worked fine on a few devices, however on the first device with soft keyboard (htc), my elements are not aligned as it should be (keyboard is moved up and overlap some elements). I should note that I'm using my custom keyboard. How can I overcome this ?
There is no automated way to adjust for the soft keyboard. In fact there is no automated way to even know that the keyboard is up or not. The only response you have to it is the soft input mode, which can either resize your app above the keyboard or pan your app to be above your keyboard.
I have two EditText views and one ImageView. My goal is to hide the ImageView when i am showing the keyboard (When the user have clicked on one of the EditText fields)
Then show the imageView again when the user have unfocused the EditText field or the keyboard is not visible anymore.
I have tried tons of different ways to do this. But nothing really works as intended. Do you guys have any idea how i could achieve this
Have you tried to detect if the keyboard is opened ? How do I Detect if Software Keyboard is Visible on Android Device?
Make debug and when is opened try to hide image . imageview.setvisibility (GONE)
if it does not work you can try to change layout
Make 2 layouts and switch visibility if the keyboard is open /closed
You can add a OnFocusChangeListener to the EditText,when you click the EditText,it will get focus,and then you can hide the ImageView.
<activity android:name="SearchResultsActivity"
android:windowSoftInputMode="adjustPan"/>
adjustPan:
The activity’s main window is not resized to make room for the soft keyboard. Rather, the contents of the window are automatically panned so that the current focus is never obscured by the keyboard and users can always see what they are typing. This is generally less desirable than resizing, because the user may need to close the soft keyboard to get at and interact with obscured parts of the window.
regards! :)
You can do one thing, place UIView-> UIImageView -> UITextfield1-> UITextField2.Handle the UIImageView hiding state in textfield delegates which are Begin and End editing delegate methods
In my application, I am showing/hiding the keyboard to allow the user to manipulate a custom widget. There is no EditText that has focus.
The problem I am having is that I want the layout to adjust in size when the keyboard shows. This is normally done by adding android:windowSoftInputMode="adjustResize" to the activity tag in the manifest. This does work when the device (currently the 7in Galaxy Tab running 2.2) is in portrait mode but when rotated to landscape, the layout does not adjust size and the keyboard hides half the screen.
Now, I noticed that if instead I use an EditView that has android:imeOptions="flagNoExtractUi", the layout resizes appropriately. Is there any way to achieve the same effect on a keyboard displayed through a window token?
Adding a hidden EditView to the screen is not ideal since it will change the implementation rather drastically.
For reference, here is the code I use to show the keyboard within the custom widget.
mInputMethod = (InputMethodManager)getContext().getSystemService(Context.INPUT_METHOD_SERVICE);
mInputMethod.toggleSoftInput(InputMethodManager.SHOW_FORCED, InputMethodManager.HIDE_IMPLICIT_ONLY);
requestFocus();
setOnKeyListener(this);
and to hide.
mInputMethod.hideSoftInputFromWindow(getWindowToken(), 0);
setOnKeyListener(null);
I've created a custom IME for Android tablets and I'm having trouble resizing when the screen is in horizontal orientation. Whenever an EditText is clicked while the screen is horizontal, the IME takes over the entire screen with the standard EditText and Button combo with my custom IME at the bottom of the screen. However, I'd like for the IME to simply pop up without that and type directly into the field that was originally clicked, as it does in horizontal orientation. I've looked at the SoftKeyboard example, which accomplishes this (at least on honeycomb) and can't find exactly where they are setting that effect.
Sorry if this is a duplicate, I've tried searching but couldn't find this exact question.
If anyone else is having this issue, you can prevent your IME from entering fullscreen mode by overriding the onEvaluateFullscreenMode() method, which is what determines whether or not your IME will display in full screen.
Now I'm having different issues but that's for a different thread!