如何在刮刮卡视图中禁用刮刮卡?

时间:2019-11-29 06:37:39

标签: android

这就是我所做的

holder.scratchView.setRevealListener(new ScratchView.IRevealListener() {
            @Override
            public void onRevealed(ScratchView scratchView) {
                Toast.makeText(context, "Reveled", Toast.LENGTH_LONG).show();

            }

            @Override
            public void onRevealPercentChangedListener(ScratchView scratchView, float percent) {
                if (percent >= 0.5) {
                    Log.e("Reveal Percentage", "onRevealPercentChangedListener: " + String.valueOf(percent));
                }
            }
        });

如何在刮刮卡视图中禁用刮刮功能?

1 个答案:

答案 0 :(得分:0)

我想,您正在使用此库:- https://github.com/sharish/ScratchView

基本上,

holder.scratchView.setOnTouchListener(new OnTouchListener() {
        @Override
        public boolean onTouch(View v, MotionEvent event) {
            // Do nothing
            return false;
        }

缺点是,您不能再次启用它