Android Scratch Card View

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
6 forks.
48 stars.
0 open issues.
Recent commits:

  • ,
  • ,
  • ,
  • ,
  • ,

826 total views, 2 views today

(Visited 446 times, 1 visits today)

You May Also Like

About the Author: Android Developer

This is Mohammad I am Android Application Developer. I am the founder of Android Tutorial Online blog. I am programming lover and professional blogger from India. I spend most of my time doing programming and helping other programmers. This Android tutorial online blog for learning and share Android code.
My Chatbot
Powered by Replace Me