Android - Activity that does not fill the parent screen

匿名 (未验证) 提交于 2019-12-03 01:10:02

问题:

Any idea why this doesn't create an activity that looks like a popup instead of an activity that completely fills the screen?

 

I assumed that I only needed to set the layout height and layout width to something other than "fill_parent", but it still shows up as a black screen that completely fills the screen.

Ultimately, I simply want to create a popup, but I do not want to use an AlertDialog. Is this possible?

回答1:

You must set your Activity's window to be floating. You can do this either by giving your activity the Dialog style defined by Android (android:style/Theme.Dialog), or define your own style, like this:

Then set the style on your activity in the application's Manifest.



回答2:

On my phone but check this website here it shows how to use PopupWindow correctly.

Hope this helps or points you in the right direction.



标签
易学教程内所有资源均来自网络或用户发布的内容,如有违反法律规定的内容欢迎反馈
该文章没有解决你所遇到的问题?点击提问,说说你的问题,让更多的人一起探讨吧!