Android 刮刮卡 - ScratchView

EliseKovar 8年前
   <h2>介绍:</h2>    <p>刮刮卡效果,支持刮文字和图片。</p>    <h2>运行效果:</h2>    <p><img alt="Android 刮刮卡 - ScratchView" src="https://simg.open-open.com/show/5c6d844def73918d50d3836ff50fa2e9.gif"><img alt="Android 刮刮卡 - ScratchView" src="https://simg.open-open.com/show/fa79c6236d6e1bbe3ee20dde45b6f408.gif"></p>    <p> </p>    <h2>使用</h2>    <h3>ScratchImageView</h3>    <p>XML</p>    <pre>  <code class="language-java"><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"    />  </code></pre>    <p>JAVA</p>    <pre>  <code class="language-java">ScratchImageView scratchImageView = new ScratchImageView(this);    scratchImageView.setRevealListener(new ScratchImageView.IRevealListener() {      @Override      public void onRevealed(ScratchImageView tv) {          // on reveal      }  });</code></pre>    <h3>ScratchTextView</h3>    <p>XML</p>    <pre>  <code class="language-java"><com.cooltechworks.views.ScratchTextView    android:layout_width="wrap_content"    android:layout_height="wrap_content"    android:gravity="center|end"    android:text="@string/flat_200"    android:textSize="15sp"    android:textStyle="bold" />  </code></pre>    <p>JAVA</p>    <pre>  <code class="language-java">ScratchTextView scratchTextView = new ScratchTextView(this);    scratchTextView.setRevealListener(new ScratchTextView.IRevealListener() {      @Override      public void onRevealed(ScratchTextView tv) {          //on reveal      }  });</code></pre>    <h2>引入工程</h2>    <ul>     <li>Add the following configuration in your build.gradle file.</li>    </ul>    <pre>  <code class="language-java">repositories {      jcenter()      maven { url "https://jitpack.io" }  }    dependencies {      compile 'com.github.cooltechworks:ScratchView:v1.0'  }</code></pre>