Gallery/AdapterView Child Drawable State

前端 未结 3 1679
心在旅途
心在旅途 2021-01-12 09:29

I am using a Gallery view where the view corresponding to each item is non-trivial and consists of text as well as multiple buttons.

When I click to drag the gallery

3条回答
  •  小鲜肉
    小鲜肉 (楼主)
    2021-01-12 10:19

    If you happen to extend from Gallery to create your own custom version of it, you can simply do:

      @Override
      public boolean onDown(MotionEvent e) {
        // Ignore onDown events in order to avoid having every child's state set to 'pressed'
        return true;
      }
    

    This will still allow the custom gallery's children to properly receive click events, and swiping / flinging works as intended.

提交回复
热议问题