Android ViewPager get the current View

前端 未结 15 2352
天命终不由人
天命终不由人 2020-11-28 06:24

I have a ViewPager, and I\'d like to get the current selected and visible view, not a position.

  1. getChildAt(getCurrentItem) returns wrong Vi
15条回答
  •  执念已碎
    2020-11-28 06:40

    viewpager.getChildAt(0)
    

    this always returns my currently selected view. this worked for me but I don't know-how.

提交回复
热议问题