How to test if a fragment view is visible to the user?
问题 I have a ViewPager, each page is a Fragment view. I want to test if a fragment is in a visible region. the Fragment.isVisible only test the fragment is attached to a activity the fragment is set to visible the fragment has been added to a view The ViewPager will create 3 (by default) fragment and all three of them meet the above criteria, but only one is actually visible to the user (the human eyes ) 回答1: You're right there is a better way to do this! Have a look at the FragmentPagerAdapter