Every Android applications layout management in proper and attractive way is key of success of that application. Today we discuss about a library named AwesomeLayoutManager contains a LayoutManager implementation with the help of which you can:
- Draw your views in vertical and horizontal orientations
- Make animated transition between vertical and horizontal mode
- Draw your views in vertical orientation like a “previews” with cute scale effect
- Scroll your views like a normal RecyclerView or like a ViewPager
[tmh_ads]
You can also see my previous article on Create dynamic Android layout:
You can see demo above and now we dive in implementation of this library
How to setup AwesomeLayoutManager Android Layout Library
Make sure you use jcenter repository
repositories { jcenter() }
Add dependency
dependencies { compile 'com.forcelain.awesomelayoutmanager:awesomelayoutmanager:1.0' ... }
All you need is to create and setup an AwesomeLayoutManager instance
layoutManager = new AwesomeLayoutManager(); //how much your views will be scaled layoutManager.setScaleFactor(0.5f); //beheave like a ViewPager or not layoutManager.setPagination(true); // how much an item view will be high in vertical mode layoutManager.setPageHeightFactor(.7f); // time of transition between vertical and horizontal mode layoutManager.setTransitionDuration(450); recyclerView.setLayoutManager(layoutManager);
You can scroll your views like a normal RecyclerView
layoutManager.setPagination(false);
Also you can control the maximum height of views. For instance, make it small:
layoutManager.setPageHeightFactor(.7f);
You can find a working example in the “app” module
Hope you like this tutorial if any issues or suggestion you have please comment us.
Share your thoughts