PopupWindow rolePop=new PopupWindow();
rolePop.setContentView(popView);
rolePop.setWidth(ViewGroup.LayoutParams.MATCH_PARENT);
//获取屏幕高度
DisplayMetricsdisplaymetrics= getResources().getDisplayMetrics();
intScreenHeight=displaymetrics.heightPixels;
//获取状态栏高度
intstatusBarHeight= -1;
//获取status_bar_height资源的ID
intresourceId= getResources().getIdentifier("status_bar_height","dimen","android");
if(resourceId>0) {
//根据资源ID获取响应的尺寸值
statusBarHeight= getResources().getDimensionPixelSize(resourceId);
}
//屏幕高度减去状态栏的高度
rolePop.setHeight(ScreenHeight-statusBarHeight);