<分区>
以下代码:
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,但我得到了同样的错误。