Left-right arrow indicators over a ViewPager

前端 未结 5 1428
小蘑菇
小蘑菇 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:40

    First use relative layout as your parent layout

    second then add view pager inside it with match parent attribute on it

    third take two image buttons over the view pager but in under the hierarchy of parent layout give them center vertical as a gravity and keep their side as right and left as per your requirement

    fourth write functional code for buttons

    fifth take static counter to get current view pager page

    on left and right button set minus and plus the view pager counter resp. and according to that show data in view pager

    this is the simple logic for code you can search it on google you will easily get it

提交回复
热议问题