سؤال

My activity is panned in order to make space for soft keyboard(keyboard is visible).

When I leave activity in this state by pressing home button, after return to this activity, layout remains panned, but keyboard is not shown. I'd love keyboard to be shown in this situation, or layout to slide down. Can somebody please help me, how to do that?

I don't want to use android:windowSoftInputMode="stateVisible" because I don't want keyboard to be shown by default.

هل كانت مفيدة؟

المحلول

So there must be some problem with fullscreen activities. When I change my activity from fullscreen to for example NoTitleBar, everything works fine.

When using fullscreen activities, the goal is to force redraw/remeasure screen in onRestart method. For this issue with fullscreen activities, I found workaround here

نصائح أخرى

You can try this piece of code when you want to show the keyboard :

((InputMethodManager)getSystemService(Context.INPUT_METHOD_SERVICE))
.showSoftInput(myEditText, InputMethodManager.SHOW_FORCED);
مرخصة بموجب: CC-BY-SA مع الإسناد
لا تنتمي إلى StackOverflow
scroll top