FlycoBanner_Master——强大的Android视图轮播类库

用法:
Extends BaseIndicaorBanner and Set Data Type
 
public class SimpleImageBanner extends BaseIndicaorBanner<BannerItem, SimpleImageBanner> {
    private ColorDrawable colorDrawable;
 
    public SimpleImageBanner(Context context) {
        this(context, null, 0);
    }
 
    public SimpleImageBanner(Context context, AttributeSet attrs) {
        this(context, attrs, 0);
    }
 
    public SimpleImageBanner(Context context, AttributeSet attrs, int defStyle) {
        super(context, attrs, defStyle);
        colorDrawable = new ColorDrawable(Color.parseColor("#555555"));
    }
 
    @Override
    public void onTitleSlect(TextView tv, int position) {
        final BannerItem item = list.get(position);
        tv.setText(item.title);
    }
 
    @Override
    public View onCreateItemView(int position) {
        View inflate = View.inflate(context, R.layout.adapter_simple_image, null);
        ImageView iv = ViewFindUtils.find(inflate, R.id.iv);
 
        final BannerItem item = list.get(position);
        int itemWidth = dm.widthPixels;
        int itemHeight = (int) (itemWidth * 360 * 1.0f / 640);
        iv.setScaleType(ImageView.ScaleType.CENTER_CROP);
        iv.setLayoutParams(new LinearLayout.LayoutParams(itemWidth, itemHeight));
 
        String imgUrl = item.imgUrl;
 
        if (!TextUtils.isEmpty(imgUrl)) {
            Glide.with(context)
                    .load(imgUrl)
                    .override(itemWidth, itemHeight)
                    .centerCrop()
                    .placeholder(colorDrawable)
                    .into(iv);
        } else {
            iv.setImageDrawable(colorDrawable);
        }
 
        return inflate;
    }
}
The Most Complex
 
in layout xml
 
<com.flyco.bannersamples.banner.SimpleImageBanner
        android:id="@+id/sib_the_most_comlex_usage"
        android:layout_width="fill_parent"
        android:layout_height="wrap_content"
        banner:bb_barColor="#88000000"
        banner:bb_barPaddingBottom="5dp"
        banner:bb_barPaddingLeft="10dp"
        banner:bb_barPaddingRight="10dp"
        banner:bb_barPaddingTop="5dp"
        banner:bb_delay="2"
        banner:bb_indicatorGravity="RIGHT"
        banner:bb_isAutoScrollEnable="true"
        banner:bb_isBarShowWhenLast="true"
        banner:bb_isIndicatorShow="true"
        banner:bb_isLoopEnable="true"
        banner:bb_isTitleShow="true"
        banner:bb_period="10"
        banner:bb_scale="0.5625"
        banner:bb_textColor="#ffffff"
        banner:bb_textSize="13.5sp"
        banner:bib_indicatorCornerRadius="3dp"
        banner:bib_indicatorGap="8dp"
        banner:bib_indicatorHeight="6dp"
        banner:bib_indicatorSelectColor="#ffffff"
        banner:bib_indicatorStyle="CORNER_RECTANGLE"
        banner:bib_indicatorUnselectColor="#88ffffff"
        banner:bib_indicatorWidth="6dp"/>
int Java Code
 
sib
    .setSelectAnimClass(ZoomInEnter.class)              //set indicator select anim
    .setSource(DataProvider.getList())                  //data source list
    .setTransformerClass(ZoomOutSlideTransformer.class) //set page transformer
    .startScroll();
The Simplest
 
in layout xml
 
<com.flyco.bannersamples.banner.SimpleImageBanner
       android:id="@+id/sib_simple_usage"
       android:layout_width="fill_parent"
       android:layout_height="wrap_content"
       banner:bb_scale="0.5625"/>
int Java Code
 
sib
   .setSource(DataProvider.getList())
   .startScroll();
 
评论
添加红包

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

当前余额3.43前往充值 >
需支付:10.00
成就一亿技术人!
领取后你会自动成为博主和红包主的粉丝 规则
hope_wisdom
发出的红包
实付
使用余额支付
点击重新获取
扫码支付
钱包余额 0

抵扣说明:

1.余额是钱包充值的虚拟货币,按照1:1的比例进行支付金额的抵扣。
2.余额无法直接购买下载,可以购买VIP、付费专栏及课程。

余额充值