How to check visibility of software keyboard in Android?

前端 未结 30 4487
半阙折子戏
半阙折子戏 2020-11-21 04:43

I need to do a very simple thing - find out if the software keyboard is shown. Is this possible in Android?

30条回答
  •  悲哀的现实
    2020-11-21 05:23

    I used a little time to figure this out... I ran it some CastExceptions, but figured out that you can replace you LinearLayout in the layout.xml with the name of the class.

    Like this:

    
    
    
    
        
    
              ....
    
        
    
    
    
    

    That way you do not run into any cast issues.

    ... and if you don't want to do this on every page, I recommend that you use "MasterPage in Android". See the link here: http://jnastase.alner.net/archive/2011/01/08/ldquomaster-pagesrdquo-in-android.aspx

提交回复
热议问题