mRadioGroup.getLocationOnScreen(location);
int w = View.MeasureSpec.makeMeasureSpec(0,View.MeasureSpec.UNSPECIFIED);
int h = View.MeasureSpec.makeMeasureSpec(0,View.MeasureSpec.UNSPECIFIED);
mRadioGroup.measure(w, h);
kyqNewsPopupWindow.setTvNotice("测试测试事儿成都");
kyqNewsPopupWindow.getContentView().measure(View.MeasureSpec.UNSPECIFIED, View.MeasureSpec.UNSPECIFIED);
int popWidth=kyqNewsPopupWindow.getContentView().getMeasuredWidth();
int popHeight=kyqNewsPopupWindow.getContentView().getMeasuredHeight();
int height = mRadioGroup.getMeasuredHeight();
int x = getScreenWidth(getBaseContext())*5/8-popWidth/2;
int y = location[1]-height-14;
kyqNewsPopupWindow.showAtLocation(mRadioGroup, Gravity.NO_GRAVITY, x, y);
popupwindow设置位置
最新推荐文章于 2025-09-23 11:06:10 发布
本文介绍了一种使用PopupWindow显示自定义视图的方法,并详细说明了如何测量视图尺寸及确定PopupWindow的位置,确保其准确显示在指定位置。
5万+

被折叠的 条评论
为什么被折叠?



