Can't hide soft keyboard using Titanium SDK - Android - android

I have an action bar that contains a Titanium searchView. Currently the searchView receives focus when the page loads and the soft keyboard is shown.
I need the soft keyboard to not be shown by default so that list data beneath it is viewable.
I have tried setting the windowSoftKeyboard property to hidden on the window as well as the searchView.
I've also tried using the blur method in various event listeners to hide the keyboard however nothing seems to work.
This is straight forward to do natively using Java so I feel there should be a straightforward way to do this using Titanium.

You can try below statements one by one.
First Solution: Define below window property in either XML or TSS
"windowSoftKeyboard":Titanium.UI.Android.SOFT_INPUT_ADJUST_PAN
Second solution: This should write on window onOpen or onFocus listener
Titanium.UI.Android.hideSoftKeyboard();

Related

How to disable onscreenkeyboard in libgdx (android)

I have created my own onscreenkeyboard. When i focus to textfield it will automatically popup the keyboard. If i add Gdx.input.setOnscreenKeyboardVisible(false), to the focusing method the keyboard will show up anyway for a second. Has anyone got a workaround for this?
Thanks!
According to the documentation, you should be able to do setOnScreenKeyboard() and supply your custom OnScreenKeyboard implementation. My guess is that it is trying to call show() on both your keyboard and the default keyboard. Setting the keyboard to use will prevent the default from showing up.

Adjust layout when soft keyboard is visible

I am developing an application for android devices, which manages TV channels and shows. In it there is an option for the user to add channels in the system using a custom widget. The widget uses autocompleteTextView. My layout does not adjust itself when the soft keyboard appears.
These are the 2 states of the layout:
The keyboard blocks the user from viewing the options in the dropdown and the field below it. I have already tried the solution here and here. But none of them got it to work.
I want to move the layout of the widget itself, rather then the whole layout behind. How to go about this problem?

adjust_pan behavior in Webview in fullscreen

I am trying to solve the issue that in my Webview, when a user selects a textfield, the keyboard that appears covers the text field below.
Instead, I need a behavior where the text field is moved right above the keyboard, like what the flag SOFT_INPUT_ADJUST_PAN would do.
Based on testing, it seems like by default on a Webview, it is displaying the keyboard below the field.
But my WebView is in fullscreen. I am calling this.getWindow().setFlags(WindowManager.LayoutParams.FLAG_FULLSCREEN,WindowManager.LayoutParams.FLAG_FULLSCREEN) in my activity);
and this seems to make android stop doing the default 'pan and scan' behavior.
I've tried to call
getWindow().setSoftInputMode(WindowManager.LayoutParams.SOFT_INPUT_ADJUST_PAN)
and even
getWindow().setSoftInputMode(WindowManager.LayoutParams.SOFT_INPUT_ADJUST_RESIZE)
but that did not fix it.
I need to set the activity to fullscreen because I want to hide both the title bar and the status bar, so removing it is not an option unless there is another way to hide the status bar.
Any idea on how to solve this issue?
Laurent
You need to remove FLAG_FULLSCREEN flag. There is a bug somewhere in the OS machinery and with some digging around i have found the following:
without any extra scroll view around web view adjustPan never worked for me. Unfortunatelly the add scroll view also not always helps.
adjustScroll works for me when FLAG_FULLSCREEN is not present for the activity the webview is in.
So to sum it up the safest option to go with when it comes to WebView is adjustResize not full screen activity.
For me this worked:
getDialog().getWindow().setSoftInputMode(WindowManager.LayoutParams.SOFT_INPUT_ADJUST_RESIZE);

Removing navigation buttons from android soft keyboard?

I would like to remove the navigation buttons at the bottom of the soft keyboard ( the buttons with the arrow- they act like a tab key to move between fields). I have had no luck trying to find a way to do this. Does anyone have any suggestions
What you're describing is device-specific, as each device has its own default soft keyboard. Unfortunately, you'll need to make a custom keyboard.
Look at the Keyboard class.
I don't believe it's possible to remove the button from the keyboard, but you can at least specify which neighbor the field gives focus to. See Handling UI Events on the Android Dev Guide.
Perhaps it's possible to set nextFocusDown to nothing, so the keyboard doesn't let the user navigate in that fashion. If that doesn't work, you might consider setting the field that takes focus next to setFocusable(false).

detect soft keyboard being hidden

i have an activity with an edit box, when the user touches inside the edit box, the soft keyboard comes up. if the user presses the hardware "back" button, the soft keyboard goes away. I want to detect this situation. I have looked around and the best response i've seen so far is this one:
http://groups.google.com/group/android-developers/browse_thread/thread/9d1681a01f05e782
my question is -- how can you detect if your application window has been resized?
I added this text to my activities in my android manifest file:
android:windowSoftInputMode="adjustResize"
but I'm not quite sure how to detect the change.
any help greatly appreciated.
Android does not provide an API for checking if the keyboard is visible or not. You can, however, key off the height of your top level layout to determine this information.
First, you have to set your activity's android:windowSoftInputMode attribute to "adjustResize".
Then, create a new class that extends your desired layout type (eg LinearLayout). In that class, you can override a few different methods that will be called as the height of your layout changes (due to the keyboard being shown or hidden). When these calls are triggered, you can compare the height of your layout to the height of the screen. If there's a substantial difference between the two (ie more than just the size of the notification bar), the keyboard is visible.
Finally, make sure that you use your new class as the top level layout in your layout xml (eg in place of LinearLayout).
If you would like a more thorough explanation, I've written one up: http://www.cannedcoding.com/2011/08/soft-keyboard.html
Creating an Input Method Service (See http://developer.android.com/reference/android/inputmethodservice/InputMethodService.html) to listen for the back button might work. When it is pressed, you can pass that on to your activity which then does what you want it to do along with removing the soft keyboard.

Categories

Resources