ScratchView
Intro
ScratchView repo is UX Design involving scratch cards like views which are scratched to reveal the information they conceal. There are two types of ScratchView
-
- A Child of ImageView which conceals the image. Scratching over the view will reveal the hidden image.
-
- A Child of TextView which conceals the text. Scratching over the view will reveal the hidden text.
Demo Screen
ScratchImageView | ScratchTextView |
---|---|
Useful Methods
Both the views have following three methods which are useful to reveal or determine whether revealed and listener during revealing the hidden text/image.
isRevealed()
- tells whether the text/image has been revealed.reveal()
- reveals the image/text if not revealed yet.setRevealListener(IRevealListener)
- a callback listener interface which gets called back when user reveals the text/image through onReveal() method.
Usage
ScratchImageView
"> XML
<com.cooltechworks.views.ScratchImageView android:id="@+id/sample_image" android:layout_width="wrap_content" android:layout_height="wrap_content" android:background="@android:color/white" android:src="@drawable/img_sample2" />