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

LinePagerIndicator not work when smoothScroll is false #298

Open
Dullyoung opened this issue Jun 5, 2024 · 1 comment
Open

LinePagerIndicator not work when smoothScroll is false #298

Dullyoung opened this issue Jun 5, 2024 · 1 comment

Comments

@Dullyoung
Copy link

onPageSelected is empty implemention
Add below code in LinePagerIndicator can fix but no anim

    @Override
    public void onPageSelected(int position) {
        PositionData current = FragmentContainerHelper.getImitativePositionData(mPositionDataList, position);
        float leftX;
        float rightX;
        if (mMode == MODE_MATCH_EDGE) {
            leftX = current.mLeft + mXOffset;
            rightX = current.mRight - mXOffset;
        } else if (mMode == MODE_WRAP_CONTENT) {
            leftX = current.mContentLeft + mXOffset;
            rightX = current.mContentRight - mXOffset;
        } else {    // MODE_EXACTLY
            leftX = current.mLeft + (current.width() - mLineWidth) / 2;
            rightX = current.mLeft + (current.width() + mLineWidth) / 2;
        }

        mLineRect.left = leftX;
        mLineRect.right = rightX;
        mLineRect.top = getHeight() - mLineHeight - mYOffset;
        mLineRect.bottom = getHeight() - mYOffset;

        invalidate();
    }
@mejikomtv
Copy link

same problem. can help please

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

No branches or pull requests

2 participants