解決辦法:
在繼承PopupWindow后 银室,重寫showAsDropDown()方法,我遇到的問題是 在打開軟鍵盤后動態(tài)關(guān)閉鍵盤顯示位置出現(xiàn)問題
原因:在android 7.0后PopupWindow顯示位置存在繪制錯誤愿卒。
復(fù)制代碼進行粘貼就可以。
@Override
public void showAsDropDown(View anchor) {
if (Build.VERSION.SDK_INT <24) {
super.showAsDropDown(anchor);
? ? }else {
int[] location =new int[2];
? ? ? ? anchor.getLocationOnScreen(location);
? ? ? ? int x = location[0];
? ? ? ? int y = location[1];
? ? ? ? super.showAtLocation(anchor, Gravity.NO_GRAVITY, 0, y + anchor.getHeight());
? ? }
}