android-softkeyboard

How to check visibility of software keyboard in Android?

随声附和 提交于 2019-11-25 23:56:44
问题 I need to do a very simple thing - find out if the software keyboard is shown. Is this possible in Android? 回答1: NEW ANSWER added Jan 25th 2012 Since writing the below answer, someone clued me in to the existence of ViewTreeObserver and friends, APIs which have been lurking in the SDK since version 1. Rather than requiring a custom Layout type, a much simpler solution is to give your activity's root view a known ID, say @+id/activityRoot , hook a GlobalLayoutListener into the ViewTreeObserver

Difference between adjustResize and adjustPan in android?

纵饮孤独 提交于 2019-11-25 23:46:42
问题 I tried to write a code which is used to re-size the UI components when soft-keyboard appears. When I use adjustResize, it res-size the UI components and at the same time adjustPan gave me same output. I want to know the difference between them and when to use each component? Which one(adjustPan or adjustResize) is good for resizing UI? Here is my xml: <ScrollView xmlns:android=\"http://schemas.android.com/apk/res/android\" android:layout_width=\"match_parent\" android:layout_height=\"match

Soft keyboard open and close listener in an activity in Android

☆樱花仙子☆ 提交于 2019-11-25 20:53:42
I have an Activity where there are 5 EditText s. When the user clicks on the first EditText , the soft keyboard opens to enter some value in it. I want to set some other View 's visibility to Gone when the soft keyboard opens and also when the user clicks on the first EditText and also when the soft keyboard closes from the same EditText on the back button press. Then I want to set some other View 's visibility to visible. Is there any listener or callback or any hack for when the soft keyboard opens from a click on the first EditText in Android? This only works when android