Giter Site home page Giter Site logo

Comments (7)

nshmura avatar nshmura commented on July 19, 2024

Hi @gregacucnik ,
Thank you for your reporting!
I'll check this issue, please wait.

from recyclertablayout.

nshmura avatar nshmura commented on July 19, 2024

@gregacucnik
Sadly enough, I can't reproduce this bug.
Would you please tell me the program that reproduces this bug?

from recyclertablayout.

gregacucnik avatar gregacucnik commented on July 19, 2024

This occurs on Nexus 5 running Marshmallow 6.0.1 (and 6.0). I tried old Samsung S3 with 4.3 and it works correctly.

In Activity onCreate i set RecyclerTabLayout with custom adapter and current item is in the middle of all possible items (51 items, the middle one is 25).

from recyclertablayout.

nshmura avatar nshmura commented on July 19, 2024

@gregacucnik Sorry for late response. I still can't reproduce this bug.
Is it possible that you show the source code ?

from recyclertablayout.

gregacucnik avatar gregacucnik commented on July 19, 2024

I cant send you the source code because its part of a massive project.
Im trying to alter your demo to get the bug to occur but i also cant do it.

I can give your more directions:

  • im using Fragments with an custom FragmentStatePagerAdapter
  • i use setupWithAdapter method
  • after everything is initialized i set current item to the middle (something like your demo Years)
  • Tab Layout scroll is disabled
  • In the onCreateViewHolder i alter each item width in order to set have specific number of items visible in the Tab Layout

I found that the problem is in the onCreateViewHolder where i change the item width. If i remove this code Tab Layout is scrolled correctly (setAutoMeasureEnabled is also removed). However it doesnt happen in your demo.

Here is the approximate code:

 @Override
    public ViewHolder onCreateViewHolder(ViewGroup parent, int viewType) {
        View view = LayoutInflater.from(parent.getContext())
                .inflate(R.layout.layout_custom_view01_tab, parent, false);

        ViewGroup.LayoutParams layoutParams = view.getLayoutParams();
        layoutParams.width = parent.getWidth() / 3;

        view.setLayoutParams(layoutParams);

        return new ViewHolder(view);
    }

Currently, I dont have time to investigate why this happens. It seems that is has something to do with measuring layout (maybe also connected with fragments).

from recyclertablayout.

nshmura avatar nshmura commented on July 19, 2024

@gregacucnik Thank you for your detailed information!

from recyclertablayout.

nshmura avatar nshmura commented on July 19, 2024

I can't reproduce with support library 26.0.1 on Nexus 5 running Marshmallow 6.0.1.

If you have had this issue yet, please open this issue again.

from recyclertablayout.

Related Issues (20)

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. 📊📈🎉

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google ❤️ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.