這個版本發生在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 > 18)
dialog.showAsDropDown(getSupportActionBar().getCustomView(), 500, 0, Gravity.END);
else
dialog.showAsDropDown(getSupportActionBar().getCustomView(), 500, 0);