【Android开发坑系列】之PopupWindow
生活随笔
收集整理的这篇文章主要介绍了
【Android开发坑系列】之PopupWindow
小编觉得挺不错的,现在分享给大家,帮大家做个参考.
java.lang.NullPointerException
at android.widget.PopupWindow$1.onScrollChanged
if (Build.VERSION.SDK_INT < Build.VERSION_CODES.ICE_CREAM_SANDWICH) {try {final Field fAnchor = PopupWindow.class.getDeclaredField("mAnchor");fAnchor.setAccessible(true);Field listener = PopupWindow.class.getDeclaredField("mOnScrollChangedListener");listener.setAccessible(true);final ViewTreeObserver.OnScrollChangedListener originalListener = (ViewTreeObserver.OnScrollChangedListener) listener.get(mPopPm);ViewTreeObserver.OnScrollChangedListener newListener =new ViewTreeObserver.OnScrollChangedListener() {public void onScrollChanged() {try {View mAnchor = (View) fAnchor.get(mPopPm);if (mAnchor == null) {return;} else {originalListener.onScrollChanged();}} catch (Exception e) {e.printStackTrace();}}};listener.set(mPopPm, newListener);} catch (Exception e) {e.printStackTrace();}
if (mPopupWindow != null) {mPopupWindow.dismiss();mPopupWindow = null;}
转载于:https://www.cnblogs.com/kaima/p/3160897.html
总结
以上是生活随笔为你收集整理的【Android开发坑系列】之PopupWindow的全部内容,希望文章能够帮你解决所遇到的问题。
- 上一篇: 岁末年初3Q大战惊现高潮,360震撼推出
- 下一篇: Android amr语音编解码解惑 【