GithubHelp home page GithubHelp logo

Comments (3)

xuexiangjys avatar xuexiangjys commented on July 23, 2024

哪个seekBar?

from xui.

renyun2 avatar renyun2 commented on July 23, 2024

所有seekbar XSeekBar XRangeSlider 都是这样的情况,放在滚动界面就不好用了。放在边缘滑动时还会触动手势返回,我通过继承 然后在滑动超过10个单位时候调用 parent.requestDisallowInterceptTouchEvent(true) 可以解决问题:

class MyXRangeSlider @jvmoverloads constructor(
context: Context, attrs: AttributeSet? = null, defStyleAttr: Int = 0
) : XRangeSlider(context, attrs, defStyleAttr) {

private var downX = 0f

private var isDispatch = false

@SuppressLint("ClickableViewAccessibility")
override fun onTouchEvent(event: MotionEvent): Boolean {
    when (event.action) {
        MotionEvent.ACTION_DOWN -> {
            downX = event.x
            isDispatch = false
        }
        MotionEvent.ACTION_MOVE -> {
            if (abs(downX - event.x) > 10f) {
                isDispatch = true
            }
        }

        MotionEvent.ACTION_UP -> {
            isDispatch = false
        }
    }
    return super.onTouchEvent(event)
}

override fun dispatchTouchEvent(event: MotionEvent?): Boolean {
    if (event?.action == MotionEvent.ACTION_MOVE) {
        parent.requestDisallowInterceptTouchEvent(isDispatch)
    } else {
        parent.requestDisallowInterceptTouchEvent(false)
    }
    return super.dispatchTouchEvent(event)
}

}

from xui.

xuexiangjys avatar xuexiangjys commented on July 23, 2024

已修复
05d9eda

from xui.

Related Issues (20)

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. 📊📈🎉

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google ❤️ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.