From 3e9597e40cad38ee84672a5244d3f439fca35e45 Mon Sep 17 00:00:00 2001
From: 18034727885 <973609879@qq.com>
Date: 星期一, 29 六月 2026 16:07:14 +0800
Subject: [PATCH] 修复问题
---
common/src/main/java/com/xw/common/custom/SlideButtonView.kt | 10 ++++++++++
1 files changed, 10 insertions(+), 0 deletions(-)
diff --git a/common/src/main/java/com/xw/common/custom/SlideButtonView.kt b/common/src/main/java/com/xw/common/custom/SlideButtonView.kt
index d13823a..d71bf32 100644
--- a/common/src/main/java/com/xw/common/custom/SlideButtonView.kt
+++ b/common/src/main/java/com/xw/common/custom/SlideButtonView.kt
@@ -56,6 +56,12 @@
private var maxThumbX: Float = 0f
private var isDragging = false
private var slideThreshold: Float = 0.7f
+ //是否能够使用
+ var enable: Boolean = true
+ set(value) {
+ field = value
+ invalidate()
+ }
private val scroller = Scroller(context, DecelerateInterpolator())
private var onSlideCompleteListener: (() -> Unit)? = null
@@ -78,6 +84,7 @@
thumbShape = getInt(R.styleable.SlideButtonView_thumbShape, SHAPE_ROUND_RECT)
thumbCornerRadius = getDimension(R.styleable.SlideButtonView_thumbCornerRadius, 0f)
slideThreshold = getFloat(R.styleable.SlideButtonView_slideThreshold, 0.7f)
+ enable = getBoolean(R.styleable.SlideButtonView_enable, enable)
} finally {
recycle()
}
@@ -213,6 +220,9 @@
}
override fun onTouchEvent(event: MotionEvent): Boolean {
+ if (!enable) {
+ return super.onTouchEvent(event)
+ }
when (event.action) {
MotionEvent.ACTION_DOWN -> {
val touchX = event.x
--
Gitblit v1.7.1