在图像视图工具上通过选择显示一张图片。

huangapple go评论80阅读模式
英文:

show an image on Image view tool by choose

问题

我在Android Studio中的ImageView遇到了问题,图片存在于drawable文件夹中,但在ImageView中不可选,并且扩展名是"png",有没有有帮助的解决方案。

英文:

I have a problem with Image view in android studio , the Image is exist in drawable folder but is not available to choose by Image view and the extension is "png" , any helpful solutions .

答案1

得分: 0

你好,可能你的图片名称包含大写字母或符号(只有“_”符号在名称中是允许的)。

如果不是这种情况,请记得以以下方式放置图片:android:src="@drawable/my_happy_image",或者通过编程方式实现:

ImageView myImageView = findViewById(R.id.my_image_view);
myImageView.setImageDrawable(getDrawable(R.drawable.my_happy_image));
英文:

Hi probably your image name contains Uppercases or symbols(only '_' is permited in names).

If this is not your case, remember to place the image in the following way android:src="@drawable/my_happy_image or programatically

ImageView myImageView = findViewById(R.id.my_image_view);
myImageView.setImageDrawable(getDrawable(R.drawable.my_happy_image));

huangapple
  • 本文由 发表于 2020年9月30日 02:12:48
  • 转载请务必保留本文链接:https://go.coder-hub.com/64125308.html
匿名

发表评论

匿名网友

:?: :razz: :sad: :evil: :!: :smile: :oops: :grin: :eek: :shock: :???: :cool: :lol: :mad: :twisted: :roll: :wink: :idea: :arrow: :neutral: :cry: :mrgreen:

确定