gpt4 book ai didi

android - 关于从 mipmap 文件夹中获取位图时的错误

转载 作者:行者123 更新时间:2023-12-05 00:14:22 27 4
gpt4 key购买 nike

我在我的 Visual Studio 中包含了演示项目。但它在以下陈述中向我展示了错误。我也将图像和过去复制到 mipmap 中。拜托,任何人都可以检查出什么错误并指导我。提前谢谢你。

  Bitmap fuelbar= BitmapFactory.decodeResource(getResources(), );//Bitmap image gets the fuel image from the resources folder
Bitmap blastCraft = BitmapFactory.decodeResource(getResources(), R.drawable.explosion);//Bitmap image gets the explosion image from the resources folder
Bitmap thruster = BitmapFactory.decodeResource(getResources(), R.drawable.thruster);//Bitmap image gets the small thruster image from the resources folder
Bitmap main_flame = BitmapFactory.decodeResource(getResources(), R.drawable.main_flame);//Bitmap image gets the main flame image from the resources folder

最佳答案

您将位图放置在哪个文件夹中? drawable 或 mipmap 或两者兼而有之?

如果放在 mipmap 文件夹中,则应将代码更改为:

Bitmap blastCraft = BitmapFactory.decodeResource(getResources(), R.mipmap.explosion);//Bitmap image gets the explosion image from the resources folder
Bitmap thruster = BitmapFactory.decodeResource(getResources(), R.mipmap.thruster);//Bitmap image gets the small thruster image from the resources folder
Bitmap main_flame = BitmapFactory.decodeResource(getResources(), R.mipmap.main_flame);//Bitmap image gets the main flame image from the resources folder

关于android - 关于从 mipmap 文件夹中获取位图时的错误,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/32983871/

27 4 0
Copyright 2021 - 2024 cfsdn All Rights Reserved 蜀ICP备2022000587号
广告合作:1813099741@qq.com 6ren.com