1.PopupWIndow的基本用法
※四个构造函数
//方法一: PopupWindow (Context context) //方法二: PopupWindow(View contentView) //方法三: PopupWindow(View contentView, int width, int height) //方法四: PopupWindow(View contentView, int width, int height, boolean focusable)
- ※必须具备为PopupWindow设置contentView,width,height,不然不能显示PopupWindow窗口,具体的的设置方法除了上面的构造函数外还可以用setContentView,setWidth,setHeight函数来设置。
之后就可以使用下面三个函数来显示PopupWindow窗口 //相对某个控件的位置(正左下方),无偏移 showAsDropDown(View anchor) //相对某个控件的位置,有偏移;xoff表示x轴的偏移,正值表示向左,负值表示向右;yoff表示相对y轴的偏移,正值是向下,负值是向上; showAsDropDown(View anchor, int xoff, int yoff)
PopupWindow+ScrollView的使用(可滚动的对话框)
最新推荐文章于 2024-04-16 16:48:05 发布