visual indication of over scroll in android

后端 未结 8 551
佛祖请我去吃肉
佛祖请我去吃肉 2021-02-06 01:49

I am trying to add some visual indication, that there are no more pages in the desired fling direction in the ViewPager. However I am struggling to find a place, where to put re

8条回答
  •  迷失自我
    2021-02-06 02:20

    Usually with ViewPager, one uses a PagerAdapter such as FragmentPagerAdapter or FragmentStatePagerAdapter to flood the ViewPager with contents(your content are going to be views).

    Now, when you use a PagerAdapter, you have one method called getCount(), http://developer.android.com/reference/android/support/v4/view/PagerAdapter.html#getCount%28%29 ,which will give you the size of the content.

    Since you now, know the size you can easily display a message with an if control statement.

    Try this code : http://developer.android.com/reference/android/support/v4/view/ViewPager.html

    Note: I dont think you need a custom ViewPager. You will also need to understand Fragments for ViewPager. Look at samples in ApiDemos. Its a great source.

提交回复
热议问题