我想通过可绘制文件夹中的图像(比如background.jpg )来设置我的图库的背景。
因为setBackground()方法的原型是
void setBackground(Drawable background)
Set the background to a given Drawable, or remove the background.
但是我不知道如何在这种方法中引用我的图像。我试着这样提过
Gallery galleryModified;
galleryModified.setBackground(background);
但是在第二行出现错误,说找不到资源。
如果你知道,
我正在创建一个应用程序,用户可以在其中更改几个ImageButtons的源图像,并且我将这些图像保存在SharedPreferences中。下面是我获取和保存图像的方法:
public int getImage(String item){
SharedPreferences pref = getActivity().getPreferences(Context.MODE_PRIVATE);
int id = pref.getInt(item, R.drawable.no_item);
return id;
}
public void s
当使用invoke为django项目运行python类型检查器时,我得到了错误: File "/Users/myusername/.pyenv/versions/3.8.3/lib/python3.8/genericpath.py", line 55, in getmtime
return os.stat(filename).st_mtime
FileNotFoundError: [Errno 2] No such file or directory: '.mypy_cache/3.8/django/core/exceptions.data.j