File APIs for Java Developers
Manipulate DOC, XLS, PPT, PDF and many others from your application.
http://aspose.com/file-tools
The moose likes Android and the fly likes Draw margin for Image Big Moose Saloon
  Search | Java FAQ | Recent Topics | Flagged Topics | Hot Topics | Zero Replies
Register / Login
JavaRanch » Java Forums » Mobile » Android
Bookmark "Draw margin for Image" Watch "Draw margin for Image" New topic
Author

Draw margin for Image

chen young
Ranch Hand

Joined: Sep 09, 2005
Posts: 190
Hi,

How can I draw margin for Image by using Rect object (I need also to change the margin color for every image), so in the end I will have a new Image that surrounded by margins.

Thanks
Senthil Ganesan
Greenhorn

Joined: Jul 29, 2010
Posts: 16
hi,

try to use a xml file in drawabe folder,with the shape you needed

for eg: in drawabel folder place an border.xml file like below



and in your layout.xml you can set image background has like this

<ImageView android:background="@drawable/border"/>

i hope it may help you little.
zoheb hassan
Ranch Hand

Joined: Apr 01, 2009
Posts: 150

Hi Chen

The Image you are talking about if its taking the entire screen Space then you have to find out the width and height using onSizeChanged() method and retrieve width and height of the screen using getWidth() and getHeight() methods in and use these values in onDraw() method to draw a rectangle.

Hope the solution i mentioned above works
 
I agree. Here's the link: http://aspose.com/file-tools
 
subject: Draw margin for Image