I want to draw a border around an image. But I can’t align the border at the ImageView itself (like it is done mostly) because I translate and scale the image inside of the ImageView with the ImageMatrix (the ImageView itself is fill_parent / fills the whole screen). I had the idea to add a second image (which looks like a border) and translate & scale it in the same way as the image which should have a border, but it isn’t very handy to do it this way.
Has anybody a better idea to reach that goal?
I want to draw a border around an image. But I can’t align the
Share
There are two ways to achieve this:
1) add padding to the imageView and set a background color to it.
2) another option is to override the draw method of your view and there draw the border:
Note that you are to give the middle of the line you want to draw(!) And also I haven’t run, nor compiled this, so I’m not 100% sure it’s correct, but these are the ways 🙂 Rect bounds should be the bounding rect of your view – (0,0,width,height).