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

Posted 钰娘娘ynn

tags:

篇首语:本文由小常识网(cha138.com)小编为大家整理,主要介绍了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参数:

大致写法:

.VERSION.SDK_INT > 18)
dialog.showAsDropDown(getSupportActionBar().getCustomView(), 500, 0, Gravity.END);
else
dialog.showAsDropDown(getSupportActionBar().getCustomView(), 500, 0);


以上是关于android:java.lang.NoSuchMethodError: android.widget.PopupWindow.showAsDropDown的主要内容,如果未能解决你的问题,请参考以下文章