Android, Two ImageViews transparency synchronize
Th开发者_如何学Goere are two ImageViews.
I set a Bitmap image file on ImageView1.
and ImageView1 setalpha(50) to makes transparency.
If I drag and drop ImageView1 on a ImageView2 then,
How can ImageView2 show no-transparency where intersect part.
- ImageView1.setAlpha(50)
- ImageView2.setAlpha(100)
- Create a third ImageView and set image to same color as background.
- ImageView2.setAlpha(~50?) manipulate that view's position relative to ImageView2.
For instance, if ImageView1 intersects ImageView2 at x=40 and ImageView2 is to the right. Simply set the ImageView3.left = 40, and then possibly manipulate the width from there if you need to.
Should work for simple purposes, and I think it's probably the most efficient/simple way to do something like this. By using the same color as the background, and overlaying the ImageView3, I believe it would give you the same effect as setting alpha on original picture.
As always could be wrong... let me know if you test though :-)
精彩评论