Android Scratch Card View

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

  • ScratchRelativeLayoutView
    • A Child of RelativeLayout which conceals a relative layout. Scratching over the view will reveal the hidden RelativeLayout. Also the scratch-able view is a RelativeLayout.
  • ScratchImageView
    • A Child of ImageView which conceals the image. Scratching over the view will reveal the hidden image.
  • ScratchTextView
    • A Child of TextView which conceals the text. Scratching over the view will reveal the hidden text.

Demo Screen

ScratchImageViewScratchTextViewScratchRelativeLayoutView

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

ScratchRelativeLayoutView

XML
JAVA

ScratchImageView

XML
JAVA

ScratchTextView

XML
JAVA

Adding to your project

  • Add the following configuration in your build.gradle file.

Contributors

Special Thanks


https://github.com/goibibo/ScratchCardView
9 forks.
57 stars.
0 open issues.
Recent commits:

  • ,
  • ,
  • ,
  • ,
  • ,

 4,627 total views,  1 views today

(Visited 2,084 times, 1 visits today)