H07000223 / FlycoDialog_Master

An Android Dialog Lib simplify customization.
MIT License
2.27k stars 528 forks source link

popupwindow设置为Gravity.Bottom就会失效,但是全屏的话这个属性就会失效 #61

Closed Allen-Guof closed 1 year ago

Allen-Guof commented 6 years ago

如题,用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);
}