0

I need to develop a Instant Lottery game app.

I need an idea/procedure to implement Scratchable custom widget similar to instant Lottery Tickets in Android.

The requirement is like, the actual content(secret number) should be covered by some image(which indicates scratch area). When the user touch and scratch the image, the image has to disappear slowly and the background content(secret number) should appear accordingly.

Please let me know the best way to implement this. I am in real need of it.

Thanks in advance.

4

2 回答 2

2

Conceptually, you could put your scratch area (image) on top of the number you're initially hiding. When the user performs motions on the scratch area, change the opacity of the scratch area so it fades away with every motion.

于 2010-06-10T10:02:33.457 回答
0

由于您不希望整个View更改其透明度,而只更改其被触摸的部分,因此您需要在 上手动绘制Canvas,在对象上设置 PorterDuff 模式Paint

mPaint.setXfermode(new PorterDuffXfermode(PorterDuff.Mode.SRC)) 

drawColor.TRANSPARENT

另请参阅 Android 开发人员组中的此线程:http ://groups.google.com/group/android-developers/browse_thread/thread/5b0a498664b17aa0/de4aab6fb7e97e38?lnk=gst&q=erase+transparent#

于 2010-06-20T16:52:06.123 回答