-
-
Notifications
You must be signed in to change notification settings - Fork 441
02.Docment
ZhangPan edited this page Jan 10, 2024
·
7 revisions
Methods | Description | Default |
---|---|---|
setCanLoop(boolean) | set it's can loop | default value is true |
setAutoPlay(boolean) | set can auto play | default value is true |
setInterval(int) | set the interval of item switch | unit is millisecond,default value is 3000ms |
setScrollDuration(int) | set item scroll duration | Unit is millisecond,default value is equals ViewPager2 item scroll time |
setRoundCorner(int) | set round corner for BVP. equals setRoundRect method | |
setOnPageClickListener(OnPageClickListener) | set a callback that when the item is clicked | |
setAdapter(BaseBannerAdapter<T, VH>) | set Adapter for BVP | This method must be called,Otherwise,BVP will throw a NullPointerException |
setIndicatorVisibility(int) | indicator visibility | default is VISIBLE |
setIndicatorStyle(int) | set indicator style | enum(CIRCLE, DASH、ROUND_RECT) default value is CIRCLE |
setIndicatorGravity(int) | set gravity of indicator | enum(CENTER、START、END),default value is CENTER |
setIndicatorSliderColor(int,int) | set indicator slider color | default normalColor: "#8C6C6D72",default checkedColor:"#8C18171C" |
setIndicatorSlideMode(int slideMode) | set indicator slider mode | enum(NORMAL;SMOOTH;WORM;COLOR;SCALE),default value NORMAL |
setIndicatorSliderRadius(int radius) | set indicator slider radius | default value is 4dp |
setIndicatorSliderRadius(int normalRadius,int checkRadius) | set indicator slider radius | default value is 4dp |
setIndicatorSliderWidth(int) | set Indicator slider width | default value is 8dp |
setIndicatorSliderWidth(int normalWidth, int checkWidth) | set indicator slider width | default value is 8dp |
setIndicatorHeight(int) | set indicator slider height | default value is normalIndicatorSliderWidth/2 |
setIndicatorSliderGap(int) | set space for indicator slider | default value is normalIndicatorSliderWidth |
setIndicatorView(IIndicator) | set custom indicator | Custom indicator must extends BaseIndicatorView or implements IIndicator |
setPageTransformer(ViewPager2.PageTransformer) | set page transformer,call this method will cover old transformer | |
setRevealWidth(int) | Set exposed width of the items on the left and right | |
addPageTransformer(ViewPager2.PageTransformer) | add page transformer | supported v3.0.0 |
removeTransformer(ViewPager2.PageTransformer) | Remvoe page transformer | supported v3.0.0 |
setCurrentItem(int) | Set the currently selected page. | supported v2.3.5 |
int getCurrentItem() | return current position | Supported v2.3.5 |
setPageStyle(PageStyle) | set page style for BVP | supported v2.4.0 enum(MULTI_PAGE_SCALE;MULTI_PAGE_OVERLAP) |
setPageMargin(int) | supported v2.4.0 | |
setIndicatorMargin(int left, int top, int right, int bottom) | set margin for indicator | supported v2.4.1 |
registerOnPageChangeCallback(OnPageChangeListener) | Set a callback that will be invoked whenever the page changes or is incrementally scrolled. | |
setRoundRect(int) | set round corner for BVP | Require SDK_INT>=LOLLIPOP |
setOrientation(int) | Sets the orientation of the BVP | support in v3.0.0 {@link #ORIENTATION_HORIZONTAL} or {@link #ORIENTATION_VERTICAL} |
setUserInputEnabled(int) | Enable or disable user initiated scrolling | |
setLifecycleRegistry(Lifecycle) | Add lifecycle for BVP, | |
startLoop() | start loop | Don't need call this method while init BVP |
stopLoop() | Stop loop | |
getData() | return data in BVP | |
showIndicatorWhenOneItem(boolean) | Whether to display the indicator when there is only one Item | default value is false |
stopLoopWhenDetachedFromWindow(boolean) | Whether to stop loop when the BVP detached from window | default value is true |
create(List list) | Create BVP with data | If data has fetched while you setup BannerViewPager,you can call this method |
create() | Create BVP with no data | You can call this method,If fetching data asynchronously(for example,The data is from remote server or database).While fetch data successfully,just need call refreshData() method to refresh |
refreshData(List) | Refresh if data is update | Supported in v3.1.0 |
Attributes | format | description |
---|---|---|
bvp_interval | integer | set the interval of item switch |
bvp_scroll_duration | integer | set item scroll duration |
bvp_can_loop | boolean | set BVP can cycle |
bvp_auto_play | boolean | set BVP can auto play |
bvp_indicator_checked_color | color | set checked color for indicator slider |
bvp_indicator_normal_color | color | set normal color for indicator slider |
bvp_indicator_radius | dimension | if it's circle style the value is radius of circle,if the indicator style is DASH or ROUND_RECT the value is width/2 |
bvp_round_corner | dimension | set round corner for BVP |
bvp_page_margin | dimension | set item margin |
bvp_reveal_width | dimension | it's only used when the page style is MULTI_PAGE_SCALE/MULTI_PAGE_OVERLAP,the value is two side item reveal width |
bvp_indicator_style | enum | indicator style(circle/dash/round_rect) |
bvp_indicator_slide_mode | enum | indicator slide mode(normal;smooth;worm;color;scale) |
bvp_indicator_gravity | enum | indicator gravity(center/start/end) |
bvp_page_style | enum | page style(normal/multi_page/multi_page_overlap/multi_page_scale) |
bvp_indicator_visibility | enum | indicator visibility(visible/gone/invisible) |