Android: Drawable not showing up

前端 未结 7 1787
鱼传尺愫
鱼传尺愫 2021-02-06 03:46

I have a fairly simple xml file that has an image button in it. The image shows up fine on the Graphical Layout xml designer, shows up fine when I run a development build, but a

7条回答
  •  不要未来只要你来
    2021-02-06 04:24

    try to put the image in drawable-hdpi and drawable-mdpi folder depends on what device you run you app , the image is searched in these folders...

    But puting in drawable means that the image should be available everywhere, but somethimes (depends on your manifest settings) this could not be true, I mean you can turn of the compatibility mode.

    also you can try dinamically at run time to set the image to the view

    iv.setImageResource(R.drawable.somethig);
    

提交回复
热议问题