Android how to set transparency to custom part of ImageView

I would like to set a custom part of an image view to be transparent. However, the partial view inside does not have to be a rectangle. It could be parallelogram, triangle, etc... I know I can retrieve the corners of the shape that I want to set to transparent, I just don't know what to do with those inputs.

Any help is appreciated!

Answers


You will have to manually manipulate a bitmap that you set to the image view.

Bitmap someBitmap = BitmapFactory.decodeResource(getResources(), R.drawable.someimage);
bmp.setPixel(x,y,Color.TRANSPARENT);
someImageView.setBitmap(someBitmap);

Code not tested.


Try this imageView.setBackgroundColor(Color.TRANSPARENT);


Need Your Help

Improve algorithm for finding URLs in a body of text - obj-c

objective-c algorithm url nsrange

I'm trying to come up with an algorithm to find URLs in a body of text. I currently have the following code (this was my sit down and hack it out code, and I know there has to be a better way):

iPhone Unit Tests Hang; Fail to Call -applicationDidFinishLaunching:

iphone unit-testing ocunit

I have unit tests set up for my iPhone project built using the Google Toolkit for Mac framework on top of OCUnit. I have a dependent project called "Unit Tests" that builds and runs the tests as ne...

About UNIX Resources Network

Original, collect and organize Developers related documents, information and materials, contains jQuery, Html, CSS, MySQL, .NET, ASP.NET, SQL, objective-c, iPhone, Ruby on Rails, C, SQL Server, Ruby, Arrays, Regex, ASP.NET MVC, WPF, XML, Ajax, DataBase, and so on.