Card Slider
This is an amazing card slider for the Android platform with many features and attrs to get exactly what you need.
Card Slider components
- CardSliderViewPager:
A custom ViewPager built on RTL ViewPager to support RTL and uses a page transformer to apply scaling action as shown in GIF. - CardSliderIndicator: Custom LinearLayout that that contain indicators as children views.
- CardSliderAdapter: Abstract class that must be extended and passed to CardSliderViewPager as its adapter.
Features
1- show preview of pages in left and right.
2- can resize (scale) the pages to make focused page larger in height as shown in GIF.
3- Full customize the appearance of the the CardView and ViewPager.
4- Add indicator and full customize it easily.
5- RTL Support.
Add to project
- Add it in your root build.gradle at the end of repositories:
- Add the dependency:
Find the latest version here
Usage
- Add it to your layout:
- Extend CardSliderAdapter
or using Java
-
Create item layout to return it in
getItemContentLayout
-
Add adapter to CardSliderViewPager
or using Java
5- To add indicator add it to your layout
And then bind it with your CardSliderViewPager
Attributes List
1- CardSliderViewPager
Attribute | Description | Default value |
---|---|---|
cardSlider_smallScaleFactor |
The small scale of the next and previous pages. | 1 (no resizing) |
cardSlider_baseShadow |
The CardView Elevation when selected. | 2dp |
cardSlider_minShadow |
The CardView Elevation of next and previous cards. | baseShadow * smallScaleFactor |
cardSlider_pageMargin |
The space between two pages. This must be large than baseShadow + minShadow or it will be override. | baseShadow + minShadow |
cardSlider_otherPagesWidth |
The width of displayed parts from next and previous cards . | 0 |
cardSlider_cardBackgroundColor |
The background color of the card. | White |
cardSlider_cardCornerRadius |
The corner radius of the card view. | 0 |
cardSlider_indicator |
The id of CardSliderIndicator to work with this view pager. | no indicator |
paddingLeft and right will be override with otherPagesWidth + pageMargin
2- CardSliderIndicator
Attribute | Description | Default value |
---|---|---|
default_indicator |
The indicator drawable in case of not selected | default_dot.xml |
selected_indicator |
The indicator drawable in case of selected. | selected_dot.xml |
indicator_margin |
The space between indicators | the minimum width of default_indicator and selected_indicator |