本网站(662p.com)打包出售,且带程序代码数据,662p.com域名,程序内核采用TP框架开发,需要联系扣扣:2360248666 /wx:lianweikj
精品域名一口价出售:1y1m.com(350元) ,6b7b.com(400元) , 5k5j.com(380元) , yayj.com(1800元), jiongzhun.com(1000元) , niuzen.com(2800元) , zennei.com(5000元)
需要联系扣扣:2360248666 /wx:lianweikj
一个Android的简单刮刮卡效果视图
kenrry1992 · 1232浏览量 · 发布于2019-06-03 +关注

作者skymansandy,源码scratchCardLayout。受Google Pay,PhonePe和Zomato奖励系统启发的一种简单Android刮刮卡效果视图。


特征:

刮刮卡效果到任何视图。

用ScratchCardLayout包装现有的复杂布局。

基于CardView的库。 所以CardView的所有样式都可用。

设置划痕画笔宽度。

启用/禁用划痕效果

将Drawable设置为划痕(颜色/图像)。

应该显示完整布局时设置划痕的百分比。

抓挠开始,进展(百分比)和停止时获取回调。


演示

demoScratchCardLayout.gif


用法

相关性:

 dependencies {
      implementation 'in.codeshuffle.scratchcardlayout:ScratchCardLayout:1.0.6'
 }

XML用法

  <in.codeshuffle.scratchcardview.ui.ScratchCardLayout
         android:id="@+id/scratchCard"
         android:layout_width="250dp"
         android:layout_height="250dp"
         android:layout_centerInParent="true"
         app:scratchWidth="40dp"
         app:scratchEnabled="true"
         app:scratchDrawable="@drawable/your_drawable"
         app:scratchRevealFullAtPercent="100">

         <!--Your complex view here-->
  </in.codeshuffle.scratchcardview.ui.ScratchCardLayout>

Java 用法

        //Get view reference
        ScratchCardLayout scratchCardLayout = findViewById(R.id.scratchCard);

        //Set the drawable (programmatically)
        scratchCardLayout.setScratchDrawable(getResources().getDrawable(R.drawable.car));

        //Set scratch brush width
        scratchCardLayout.setScratchWidth(30f);

        //Reveal full layout when some percent of the view is scratched
        scratchCardLayout.setRevealFullAtPercent(40);

        //Scratching enable/disable
        scratchCardLayout.setScratchEnabled(true);

        //Remove all scratch made till now
        scratchCardLayout.resetScratch();


监视可用

实现给定的接口并覆盖这些东西:

          //Implement this to your class
          yourClass extends someBaseClass implements ScratchListener

          //Set the listener
          scratchCardLayout.setScratchListener(this);

          //You'll have three main callback methods as scratch listeners
          //Scratch started
          void onScratchStarted();

          //Scracth progress (NOTE: not guaranteed to be exact percent. consider it like atleast this much percent has been scratched)
          void onScratchProgress(ScratchCardLayout scratchCardLayout, int atLeastScratchedPercent);

          //Scratch completed
          void onScratchComplete();

PlayStore 应用

https://play.google.com/store/apps/details?id=in.codeshuffle.scratchcardlayoutexample

注意

 - The progress is the value guaranteeing that the mentioned percent is atleast scratched. NOT THE EXACT PERCENTAGE (for performance reasaons)


源码使用过程中,如无法搭建或有增加其他功能需求,可联系QQ:236-0248-666 ,付费搭建安装修改服务!
温馨提示:网站源码只作为学习或研究使用,如需商业使用请购买正版!

相关推荐

Android卡片效果源码

相关信息 kenrry1992 · 653浏览 · 2019-12-04 16:40:11
安卓烟花爆炸效果

相关信息 kenrry1992 · 647浏览 · 2019-12-04 16:03:05
android模仿微信朋友圈效果源码

相关信息 kenrry1992 · 670浏览 · 2019-12-04 15:25:43
渐变颜色渐变文字渐变图像 安卓源码

相关信息 冷月葬花魂 · 859浏览 · 2019-10-31 17:32:07
安卓仿支付宝首页下拉刷新视图效果源码

相关信息 kenrry1992 · 945浏览 · 2019-10-09 09:44:58
Android一个可以上拉下滑的Ui效果

相关信息 kenrry1992 · 706浏览 · 2019-10-09 09:38:36
加载中

0评论

评论
  • 源码信息
  • 所需 0 点数
  • 源码作者:匿名作者
  • 源码大小:2.850 MB
  • 源码类型:android源码
  • 显示语言: 简体中文
  • 运行环境:未知
分类专栏
小鸟云服务器
扫码进入手机网页