2013-12-12 68 views
3

下面的代码: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,因此加入

回答

相关问题