Show view in front of soft keyboard

I have a screen like below.

截图

Screen 1 is the initial screen. It contains a Layout at top, EditText and + button below it.

When I click on the EditText then soft keyboard comes up (Screen 2).

When I click on + button then a View comes on top of soft keyboard. This View contains a Viewpager with 4 tabs and 4 Fragments. This custom View must be in front of keyboard (Keyboard should be still there but behind this view). When I hide this View then Keyboard should be there behind this View.

How can I show a View in front of soft keyboard? I tried doing this using DialogFragment and PopupWindow.

Problem with DialogFragment is that it can't be shown in front of keyboard.

Problem with PopupWindow is that if I show ViewPager in PopupWindow then it gives "IlligalArgumentException No view found for id 0X001272" inside first Fragment of ViewPager.

Am I doing something wrong? Please help me out. What is the best way to show something in front of keyboard?


If you want another layer in front of the soft keyboard such as WhatsApp emoticons and smileys which appear as a popup over the soft keyboard, you can use Emojicon library. It should, at least, give you an idea of how to implement it.

链接地址: http://www.djcxy.com/p/93042.html

上一篇: 显示java.lang.NullPointerException

下一篇: 在软键盘前显示视图