这个版本发生在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);