MPAndroidChart's K-line MarkerView custom--MotionEvent event transmission

cutting edge

When working on the K-line recently, it is necessary to display the markers of the two charts synchronously, as follows:

The MOVE event needs to be triggered smoothly between the two charts. To put it bluntly, I clicked on the topChart and started to move, and then slid to the bottomChart.

Need to respond directly to bottomChart to touch events instead of continuing on topChart.

So I "prohibited" the click event monitoring of the two charts. The quotation marks are because I still set the touch monitoring event for the two charts, but returned false directly when onTouch:

override fun onTouch(v: View, event: MotionEvent): Boolean {
        super.onTouch(v, event)
        v.performClick()
        return false
    }

Because the highlight cannot respond if the listening event is not set, a touch event is added to the parent layout of the two charts:

// ALL

 

 

Partial reference from: https://blog.csdn.net/lcr19880924/article/details/79726573

Guess you like

Origin blog.csdn.net/fwt336/article/details/115696982