Left-right arrow indicators over a ViewPager

前端 未结 5 1430
小蘑菇
小蘑菇 2021-01-30 15:04

I want to show left and right arrows over my ViewPager, to indicate swiping.

I added two ImageButtons over the ViewPager-element but those areas then block the ViewPager

5条回答
  •  执念已碎
    2021-01-30 15:20

    I figured out a solution. It's very simple.

    Instead of using ImageButtons for displaying the arrows, I now use ImageViews because they pass on any touch events to the layer underneath.

    Then, I put transparent Buttons on the fragments themselves instead, that way they won't block the ViewPagers swiping behaviour but they will fire onClick Events!

提交回复
热议问题