Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

ViewPager don't show last item #24

Closed
hai199580 opened this issue Sep 30, 2019 · 1 comment
Closed

ViewPager don't show last item #24

hai199580 opened this issue Sep 30, 2019 · 1 comment
Labels

Comments

@hai199580
Copy link

hai199580 commented Sep 30, 2019

I have a list of fragment, and i want to bind to my ViewPager, but in last page, it not show my fragment :'(

Here is my Pager Adapter

image

and item_infinity_pager.xml

<?xml version="1.0" encoding="utf-8"?>
<FrameLayout xmlns:android="http://schemas.android.com/apk/res/android"
android:id="@+id/flContainer"
android:layout_width="match_parent"
android:layout_height="match_parent">
</FrameLayout>

@siralam
Copy link
Owner

siralam commented Oct 22, 2019

Hm, I am not very sure if fragment is really supported. But I do see a problem in your code here -

You are using listPosition+1 as the id of the frameLayout. The last item of the list is used twice in the view pager to create the looping effect, so probably there are 2 FrameLayouts with the same id (listPosition of the last item). So probably the fragment is replaced to the hidden one but not the one shown.

Try other ways to assign ID instead of using list Position to see if that solves your problem.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
Projects
None yet
Development

No branches or pull requests

2 participants