android-softkeyboard

Is there any way to change android:windowSoftInputMode value from java class?

人盡茶涼 提交于 2019-11-26 12:08:04
问题 I want to act my tabs to have different windowSoftInputMode properties for each tab. How to access this property from java class when all handling of your tab is done from one single activity? Is there any way to access this manifest property from java code? 回答1: Use the following to change the softInputMode for an Activity. getWindow().setSoftInputMode(WindowManager.LayoutParams.SOFT_INPUT_STATE_HIDDEN); Use the following to change the softInput type for an EditText. mEditText.setImeOptions

How to hide Soft Keyboard when activity starts

雨燕双飞 提交于 2019-11-26 12:04:37
I have an Edittext with android:windowSoftInputMode="stateVisible" in Manifest. Now the keyboard will be shown when I start the activity. How to hide it? I cannot use android:windowSoftInputMode="stateHidden because when keyboard is visible then minimize the app and resume it the keyboard should be visible. I tried with InputMethodManager imm = (InputMethodManager) getSystemService(INPUT_METHOD_SERVICE); imm.hideSoftInputFromWindow(getCurrentFocus().getWindowToken(), 0); but it did not work. Use the following functions to show/hide the keyboard: /** * Hides the soft keyboard */ public void

Android EditText, soft keyboard show/hide event?

牧云@^-^@ 提交于 2019-11-26 09:32:44
问题 Is it possible to catch the event that Soft Keyboard was shown or hidden for EditText? 回答1: Hi I'd used following workaround: As far as my content view is a subclass of LinearLayout (could be any other view or view group), I'd overridden onMeasure method lilke following: @Override protected void onMeasure(int widthMeasureSpec, int heightMeasureSpec) { final int proposedheight = MeasureSpec.getSize(heightMeasureSpec); final int actualHeight = getHeight(); if (actualHeight > proposedheight){ //

HTML: Why does Android browser show “Go” instead of “Next” in keyboard?

泪湿孤枕 提交于 2019-11-26 08:59:26
问题 I have an HTML login form that contains following elements (in this order): input type=text (user name input) input type=password (password) input type=submit (Login button) Why does the Android browser show \"Go\" button in soft keyboard instead of \"Next\" button when the focus is in the text input ? This causes user to fail to login very easily because after entering the user name, the user presses the bottom right button in the keyboard (usually the correct action) and the form will be

How to move the layout up when the soft keyboard is shown android

梦想的初衷 提交于 2019-11-26 08:55:16
问题 I have a login screen with two EditTexts and a login button in my layout. The problem is that, when I start typing, the soft keyboard is shown and covers the login button. How can I push the layout up or above the keyboard when it appears? I do not want to use a ScrollView , just want to implement it without scrolling down. Please, suggest me some way of doing it. Thanks in advance. 回答1: Set windowSoftInputMode property to adjustPan and adjustResize <activity android:windowSoftInputMode=

How to hide Android soft keyboard on EditText

試著忘記壹切 提交于 2019-11-26 08:08:23
问题 I have an Activity with some EditText fields and some buttons as a convenience for what normally would be used to populate those fields. However when we the user touches one of the EditText fields the Android soft keyboard automatically appears. I want it to remain hidden by default, unless the user long presses the menu button. I have search for a solution to this and found several answers, but so far I can\'t get them to work. I have tried the following: 1 - In the onCreate method, this

Switch keyboard profile programmatically

廉价感情. 提交于 2019-11-26 07:34:32
问题 Is there any way that we can switch installed keyboards programmatically (without going to the settings section manually)? My requirement is that the user is presented with all the keyboards which are installed on the phone and gets a chooser dialog to switch to the one wishes? (basically we want to cut down the step to transfer him to the settings page) 回答1: This piece of code will fulfill your requirements: InputMethodManager imeManager = (InputMethodManager) getApplicationContext()

Use “ENTER” key on softkeyboard instead of clicking button

帅比萌擦擦* 提交于 2019-11-26 05:18:36
问题 Hello I\'ve got a searched EditText and search Button . When I type the searched text, I\'d like to use ENTER key on softkeyboard instead of search Button to activate search function. Thanks for help in advance. 回答1: You do it by setting a OnKeyListener on your EditText . Here is a sample from my own code. I have an EditText named addCourseText , which will call the function addCourseFromTextBox when either the enter key or the d-pad is clicked. addCourseText = (EditText) findViewById(R.id

Creating a SoftKeyboard with Multiple/Alternate characters per key

大憨熊 提交于 2019-11-26 05:00:34
问题 I\'ve followed the examples on developer.android.com regarding Input Methods and played with the SoftKeyboard sample application. These together give more than enough information regarding the creation of simple keyboard. What I can\'t see in the API is the ability to create alternate / multiple characters per key which is available on the standard Keyboard (LatinIME Keyboard). The above image is the result of a long press on the \"a\" key. When you long press a key it\'s possible to populate

How to show soft-keyboard when edittext is focused

人走茶凉 提交于 2019-11-26 03:20:05
问题 I want to automatically show the soft-keyboard when an EditText is focused (if the device does not have a physical keyboard) and I have two problems: When my Activity is displayed, my EditText is focused but the keyboard is not displayed, I need to click again on it to show the keyboard (it should be displayed when my Activity is displayed). And when I click done on the keyboard, the keyboard is dissmissed but the EditText stays focused and y don\'t want (because my edit is done). To resume,