search

Home  >  Q&A  >  body text

android - 当SeekBar包裹在一个ViewGroup中时,即使其没有被触摸,它的状态也发生改变

ringa_leeringa_lee2773 days ago729

reply all(2)I'll reply

  • 巴扎黑

    巴扎黑2017-04-17 16:45:09

    What effect do you want to achieve? Or have you encountered this problem and want to find out the cause? If you want to monitor the click event of the sub-View, you should set up monitoring on the sub-View instead of monitoring the ViewGroup. The click event is an independent event and cannot be distributed. As for the SeekBar changing color after clicking the ViewGroup, it is because the click event will also trigger the touch event. The touch event is distributed by default. The touch event brings focus, and with focus, the color changes. As a digression, your relative layout is not written rigorously. The attribute layout_wight, which only takes effect in linear layout, should not appear in relative layout

    reply
    0
  • 高洛峰

    高洛峰2017-04-17 16:45:09

    Viewgroup's onTouchEvent returns true, which means intercepting and processing the event. In this way, the subview will not receive event notifications and will not respond to the event. It is also recommended to understand the three functions of view events

    reply
    0
  • Cancelreply