Forum Xamarin.Android

Drawable - problem

I used icon.SetImageResource (Resource.Drawable.okoli); But return other image than it should (it´s image in front this image). I don´t know why.
Do you have idea?

Thank you


  • PeterDavisPeterDavis USMember ✭✭✭

    Try SetImageDrawable instead. SetImageResource can work, but it loads and decodes the images on the UI thread, which you probably don't want. SetImageDrawable does the reading and decoding on a background thread. (You can also use BitmapFactory.DecodeResource() and it will use a background thread as well.

  • cendulkacendulka USMember

    I tried this code and nothing


            icon = new ImageView (_context);
            Resources res = _context.Resources;
            icon.SetImageDrawable (res.GetDrawable (Resource.Drawable.dolu));
            //Bitmap b = BitmapFactory.DecodeResource (res, Resource.Drawable.dolu);
            //icon.SetImageBitmap (b);`
  • CheesebaronCheesebaron DKInsider, University mod

    Do you ever add the imageview as child to the root view or return it or whereever you are using it?

  • cendulkacendulka USMember

    Yes, I add to root layout.

  • cendulkacendulka USMember

    I solved it, I must delete folder bin a obj.

Sign In or Register to comment.