android-softkeyboard

Android key event for back key when soft keyboard is shown?

假装没事ソ 提交于 2019-11-29 18:06:10
问题 I am trying to capture the "back" key event when the soft keyboard is shown. I am using SDK ver 8 and can successfully capture the back key event ONLY when the soft keyboard is HIDDEN as follows: @Override public void onBackPressed() { // do something super.onBackPressed(); } The problem is that the system is not calling this method while the soft keyboard is shown. I have tried to log onKeyDown/Up() methods as well as the above method to work out what is happening in this scenario to no

how to listen to keyboard search button in searchView

非 Y 不嫁゛ 提交于 2019-11-29 17:02:22
问题 I have a SearchView. When the user clicks on the keyboard search button, I need to make a server call. What does the code for the listener look like? I am thinking I have to use OnClickListener. But the internal code for knowing it's the search button, I am not sure how to determine that. 回答1: I have done like this the onQueryTextSubmit is the method you are looking for. set setOnQueryTextListener on your search view. @Override public boolean onCreateOptionsMenu(Menu menu) { // Inflate the

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

Move Floating Action Button above keyboard

谁说我不能喝 提交于 2019-11-29 14:09:44
I have this Floating Action Button (GitHub link) and when I open a (software) keyboard the Floating Action Button hides behind the keyboard. Is there a way that I can push it above the keyboard? Edit: tab_random.xml <RelativeLayout xmlns:android="http://schemas.android.com/apk/res/android" android:layout_width="match_parent" android:layout_height="match_parent"> <View android:layout_width="match_parent" android:layout_height="156dp" android:background="@color/primary_color" /> <EditText android:layout_width="wrap_content" android:layout_height="wrap_content" android:id="@+id/from" android

How to show the soft keyboard on native activity

别来无恙 提交于 2019-11-29 13:49:55
问题 When I try to use ANativeActivity_showSoftInput() , it doesn't bring up the soft keyboard. I have tried using ANativeActivity_showSoftInput(engine->app->activity, ANATIVEACTIVITY_SHOW_SOFT_INPUT_FORCED) and ANativeActivity_showSoftInput(engine->app->activity, ANATIVEACTIVITY_SHOW_SOFT_INPUT_IMPLICIT) to show softinput, but also failed. I read the source code, and I found after start nativeActivity , NativeContentView(extend View) will be created, and when call ANativeActivity_showSoftInput ,

How can I focus on a collapsible action view EditText item in the action bar (when it is expanded) and force the soft keyboard to open?

不想你离开。 提交于 2019-11-29 11:51:21
问题 I am using Jake Wharton's excellent ActionBarSherlock library and have a collapsible search action view. I want to popup the soft keyboard when the search action view is expanded. We can read a recommended way of doing this in a DialogFragment in the "Using DialogFragments" blog post by Google (altered a bit for readability). // Show soft keyboard automatically mEditText.requestFocus(); int mode = WindowManager.LayoutParams.SOFT_INPUT_STATE_VISIBLE; getDialog().getWindow().setSoftInputMode

Android SoftKeyboard onKeyDown/Up not detecting 'alternative' keys

你说的曾经没有我的故事 提交于 2019-11-29 11:33:33
I have a view which handles input for me, I pop up a keyboard and set the view focusable. Now I can get certain key presses... @Override public boolean onKeyDown(int keyCode, KeyEvent event) { if (keyCode == KeyEvent.KEYCODE_DEL) { } else if (keyCode == KeyEvent.KEYCODE_BACK) { } else if (keyCode == KeyEvent.KEYCODE_ENTER) { } else { } } and so on... the character pressed I get by using event.getDisplayLabel() That works as long as I only want the normal letters A-Z. In other languages, more letters can be reached by long pressing a normal letter on the soft keyboard... however, these

Push up content except some view when keyboard shown

不问归期 提交于 2019-11-29 11:21:17
问题 I have a layout that contains 5 EditText and a Button and a TextView at bottom. Now when I press an EditText then the keyboard will shown and all my View is push up. Now I don't want to push my TextView and Button to above keyboard, just only want to push up all EditText inside ScrollView to above keyboard. <?xml version="1.0" encoding="utf-8"?> <LinearLayout xmlns:android="http://schemas.android.com/apk/res/android" android:id="@+id/activity_main" android:layout_width="match_parent" android

Restricting Android NumberPicker to Numeric Keyboard for Numeric Input (not Alpha keyboard)

守給你的承諾、 提交于 2019-11-29 11:01:18
Is there a way to suggest or restrict keyboard input when selecting a NumberPicker so only the number controls are shown when entering values, similar to how you can use android:inputType="number" with a EditText? I have a series of values, from 0.0 to 100.0 in 0.1 increments that I'd like to be able to use a NumberPicker to select in Android 4.3. In order to have the numbers selectable, I've created an array of strings which corresponds to these values, as shown below: NumberPicker np = (NumberPicker) rootView.findViewById(R.id.programmingNumberPicker); int numberOfIntensityOptions = 1001;

Rejusting UI with candidateview visible in custom keyboard

半腔热情 提交于 2019-11-29 10:35:43
问题 I'm working on custome keyboard .I have set setCandidatesViewShown(true) function in onCreateCandidatesView() , problem is the UI doesnt get readjusted properly. Any assistance would be greatful.. below is what I have done @Override public View onCreateCandidatesView() { LayoutInflater li = (LayoutInflater) getApplicationContext() .getSystemService(Context.LAYOUT_INFLATER_SERVICE); View wordBar = li.inflate(R.layout.wordbar, null); LinearLayout ll = (LinearLayout) wordBar.findViewById(R.id