下面的代码:View.setBackground抛出的NoSuchMethodError
View inflate = inflater.inflate(R.layout.page, null);
Drawable img = getResources().getDrawable((Integer) (item.get("img")));
inflate.findViewById(R.id.page_img).setBackground(img);
产生以下错误:
java.lang.NoSuchMethodError: android.view.View.setBackground
我不知道为什么。我已经使用R.drawable.img
尝试了setBackground,但我得到了同样的错误。在API 16,因此加入