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 > 18)
            dialog.showAsDropDown(getSupportActionBar().getCustomView(), 500, 0, Gravity.END);
        else
            dialog.showAsDropDown(getSupportActionBar().getCustomView(), 500, 0);
發佈了155 篇原創文章 · 獲贊 33 · 訪問量 14萬+
發表評論
所有評論
還沒有人評論,想成為第一個評論的人麼? 請在上方評論欄輸入並且點擊發布.
相關文章