开发者

android popup window

I'm trying to create my own virtual keyboard since no default keyboard fits my needs. I have created the layout (keyboard.xml), and I'd like to make my keyboard to appear in the bottom of the screen, as other keyboards do. I thought of using popupWindow. I tried pw.showAtLocation(this.findViewById(R.id.mainLinearLayout), Gravity.BOTTOM, 0, 0), where mainLinearLayout is the id of the (root xml element) linearLayout 开发者_C百科of the currentActivity, but I get a "android.view.WindowManager$BadTokenException: Unable to add window -- token null is not valid; is your activity running?". Any idea how to solve that ?

Thanks.


There is a way with an alertDialog. The alertDialog contains your xml. check my answer here :

android editText

And then for positionning your alerDialog see this thread :

Show AlertDialog in any position of the screen

0

上一篇:

下一篇:

精彩评论

暂无评论...
验证码 换一张
取 消

最新问答

问答排行榜