banner
Android Viewpager rotation control, application guide page controls, support vertical, horizontal cycle scrolling, extended from view support animation, indicator extension and so on;Android viewpager轮播图控件、app引导页控件,支持垂直、水平循环滚动,扩展自viewpager 支持动画,指示器扩展等。
banner: an Android carousel control
An Android ViewPager rotation control that also works as an app guide page, with vertical and horizontal cyclic scrolling, animations, and pluggable indicators. Two components ship: Banner and RecyclerBanner.
Two components, one job
banner is an Android ViewPager rotation control and application guide page control that supports vertical and horizontal cyclic scrolling, animation, and indicator extension. Two components are introduced. Banner is based on ViewPager, while RecyclerBanner is based on RecyclerView, and RecyclerBanner has advantages in memory usage and frame rate but simpler animation effects.
The methods
Both components expose a similar set of methods. createView builds the banner layout, bindView handles the banner control elements, execute fills the data and displays it, and a click listener covers tap events. setOrientation controls the scroll direction. A method sets the indicator, and setPageTransformer applies transition animations on the RecyclerBanner.
Properties and defaults
Configuration properties cover the usual knobs. The banner interval defaults to 5000 milliseconds. Auto play defaults to true, loop scrolling defaults to true, manual scroll is enabled by default, and there is a minimum loop count plus a scroll orientation setting. Indicator properties include width, height, margin, selected and unselected images or colors, and indicator shape, with defaults in dip units.
Requirements and a known bug
The banner extends ViewPager and supports horizontal and vertical automatic cyclic scrolling, usable as a carousel control and an app guide page. It requires appcompat-v7 and the recyclerview extension library. The indicator is an optional layout, since Banner is a FrameLayout, and a custom indicator can be implemented through an indicator interface. A known issue is documented for the Glide image loading framework, where a view targeted by both banner and Glide throws an illegal argument exception about the setTag method. The default layout before version 1.6.7 had only one ImageView, which triggered the issue, and version 1.6.7 rewrote the default layout to avoid it.
Community notes