Forum Xamarin.Android
We are excited to announce that the Xamarin Forums are moving to the new Microsoft Q&A experience. Q&A is the home for technical questions and answers at across all products at Microsoft now including Xamarin!

We encourage you to head over to Microsoft Q&A for .NET for posting new questions and get involved today.

Get height/width of image (from gallery) in imageView

BuzzTycaBuzzTyca DEMember
edited November 2016 in Xamarin.Android

Hello community,
I'm a Xamarin beginner and I'm working on my first App, wright now.
But at the moment I'm stuck.
I'm trying to set a Logo onto an Image (both from Android Gallery). That works pretty well, but I need to change the location of the Logo on the Image.
So, I need to know the width/height of the Image.
I tried to get them by this code:
imageViewImg.BuildDrawingCache(true); bmpImg = imageViewImg.GetDrawingCache(true); imageViewImg.SetImageBitmap(bmpImg); bmpImg = Bitmap.CreateBitmap(imageViewImg.GetDrawingCache(true));
Actually it works, but I get the Width of the whole Image view, but I need the exact width of the Image.
I allready tried a lot of snippets I've found via Google, but nothing worked.

Is there anyone, who got a hint?
Thanks a lot!


Sign In or Register to comment.