Android7.0上showAsDropDown问题

最近在Android7.0手机上发现PopWindow使用showAsDropDown(View view)方法时,View展示会从顶部充满屏幕,而不是展示在view的下方,测试发现在7.0以下和7.1均没有类似问题。Version=24时会出现!

在项目使用中,需要重写PopWindow的showAsDropDown方法:

@Override

public voidshowAsDropDown(View view) {

if(Build.VERSION.SDK_INT==24) {

Rect rect =newRect();

view.getGlobalVisibleRect(rect);

intheight = view.getResources().getDisplayMetrics().heightPixels- rect.bottom;

setHeight(height);

}

super.showAsDropDown(view);

}

你可能感兴趣的:(Android7.0上showAsDropDown问题)