How to implement customized stack view in android?

后端 未结 2 1117
孤独总比滥情好
孤独总比滥情好 2020-12-23 18:29

I have searched the internet but I couldn\'t find some good explanation or advice. Basically, I want to implement this functionality.

相关标签:
2条回答
  • 2020-12-23 18:42

    Feel free to use my library available here.

    enter image description here

    It does exactly what you want and is based on the ViewPager so you can use it with just a typical PagerAdapter of your choice.

    0 讨论(0)
  • 2020-12-23 18:51

    You can't change the original PERSPECTIVE_SHIFT_FACTOR_X because it's a private field.

    StackView uses many classes which have package visibility and are only usable in package android.widget.

    Furthermore some of those classes are pre-compiled and the source is nowhere to be found, so you can't just copy-paste them and create your own custom StackView from zero.

    You can make the views appear in a column by overriding onLayout, but once you animate them, their positions are changed back to the default. Sadly the view animations are done in private methods of StackView so nothing you can do about that either.

    You're better of creating your own class that does this, and you can reference the code used in the StackView source. Creating such a class could be a lot of work and it's definitely not in the scope of a single question.

    0 讨论(0)
提交回复
热议问题