popupwindow设置为Gravity.Bottom就会失效,但是全屏的话这个属性就会失效
Closed this issue · 0 comments
Allen-Guof commented
如题,用Android 自带的popupwindow,是可以用过重写这个方法去解决的。看了看你的popupwindow发现不是继承的Android自带的popupwidow,请问下怎么解决
/**
* 当系统版本大于7.0版本的时候 会出现popupwindow顶在view上面的情况
*/
@Override
public void showAsDropDown(View anchor, int xoff, int yoff) {
if (Build.VERSION.SDK_INT == 24 || Build.VERSION.SDK_INT == 25) {
Rect rect = new Rect();
anchor.getGlobalVisibleRect(rect);
int h = anchor.getResources().getDisplayMetrics().heightPixels - rect.bottom;
setHeight(h);
}
super.showAsDropDown(anchor, xoff, yoff);
}