android:java.lang.NoSuchMethodError: android.widget.PopupWindow.showAsDropDown

这个版本发生在android版本<16的时候,原来调用:public void showAsDropDown(View anchor, int xoff, int yoff, int gravity)要改为public void showAsDropDown(View anchor, int xoff, int yoff)。即去掉最后的gravity参数:

大致写法:

 if (Build.VERSION.SDK_INT >= 16)
            dialog.showAsDropDown(getSupportActionBar().getCustomView(), 500, 0, Gravity.END);
        else
            dialog.showAsDropDown(getSupportActionBar().getCustomView(), 500, 0);

猜你喜欢

转载自blog.csdn.net/yu_duan_hun/article/details/80049372