Android sliding items horizontal like in Duolingo App

不想你离开。 提交于 2019-12-06 08:42:48

问题


I was playing around try to implement sliding functionality like in Duolingo Activity with horizontal lessons list. The link to screen capture of this functionality LINK.

With horizontal slider the sliding has no such effects. What will be the proper way to implement such UX sliding widget?

Could I costumize the default ListView with adding the transition effect? Or could be it possible to do it with CardView? Do some external lib offer this like twoway-view?


回答1:


Use classic ViewPager to show content and then apply to pager this PageTransformer:

   if (Build.VERSION.SDK_INT >= Build.VERSION_CODES.HONEYCOMB) {
            mPager.setPageTransformer(false, new ViewPager.PageTransformer() {
                @Override
                public void transformPage(View page, float position) {
                    final float normalizedposition = Math.abs(Math.abs(position) - 1);
                    page.setScaleX(normalizedposition / 2 + 0.5f);
                    page.setScaleY(normalizedposition / 2 + 0.5f);
                }
            });
        }



回答2:


This is the exact requirement for your postings. Kindly go through this URL https://github.com/davidschreiber/FancyCoverFlow. Download the zip and run the sample. Enjoy!! Its easy to customize too...



来源:https://stackoverflow.com/questions/28025433/android-sliding-items-horizontal-like-in-duolingo-app

易学教程内所有资源均来自网络或用户发布的内容,如有违反法律规定的内容欢迎反馈
该文章没有解决你所遇到的问题?点击提问,说说你的问题,让更多的人一起探讨吧!