VerticalBannerView是一个仿淘宝APP首页轮播头条的自定义控件。
特性:
1.可自由定义展示的内容。
2.使用方式类似ListView/RecyclerView。
3.可为当前显示的内容添加各种事件,比如点击打开某个页面等。
VerticalBannerView开源项目地址:
https://github.com/guojunustb/VerticalBannerView
运行效果图:
一、项目使用
(1).添加项目依赖。
(2).添加布局。
(3).实现Adapter。
特性:
1.可自由定义展示的内容。
2.使用方式类似ListView/RecyclerView。
3.可为当前显示的内容添加各种事件,比如点击打开某个页面等。
VerticalBannerView开源项目地址:
https://github.com/guojunustb/VerticalBannerView
运行效果图:
一、项目使用
(1).添加项目依赖。
dependencies {
compile 'com.github.Rowandjj:VerticalBannerView:1.0'
}
(2).添加布局。
<LinearLayout
android:layout_width="match_parent"
android:layout_height="wrap_content"
android:gravity="center_vertical"
android:orientation="horizontal">
<TextView
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:paddingLeft="5dp"
android:text="淘宝头条"
android:textStyle="bold"/>
<View
android:layout_width="1dp"
android:layout_height="40dp"
android:layout_marginLeft="5dp"
android:layout_marginRight="5dp"
android:background="#cccccc"/>
<com.taobao.library.VerticalBannerView
xmlns:app="http://schemas.android.com/apk/res-auto"
android:id="@+id/banner"
android:layout_width="wrap_content"
android:layout_height="36dp"
app:animDuration="900"
app:gap="2000"/>
</LinearLayout>
(3).实现Adapter。
public class SampleAdapter extends BaseBannerAdapter<Model> {
private List<Model> mDatas;
public SampleAdapter01(List<Model> datas) {
super(datas);
}
&