How to show image using ImageView in Android

前端 未结 5 1520
故里飘歌
故里飘歌 2020-12-08 04:27

I am looking for the way to assign image src to image view control. I read few example and they says something src=\"@drawable\\image\" but didn\'t understand t

5条回答
  •  太阳男子
    2020-12-08 05:20

    Drag image from your hard drive to Drawable folder in your project and in code use it like this:

    ImageView image;
    
    image = (ImageView) findViewById(R.id.yourimageviewid);
    image.setImageResource(R.drawable.imagename);
    

提交回复
热议问题