Skip to content

Commit

Permalink
no message
Browse files Browse the repository at this point in the history
  • Loading branch information
youth5201314 committed Nov 8, 2016
1 parent 7a7cec5 commit b07ea31
Show file tree
Hide file tree
Showing 4 changed files with 22 additions and 10 deletions.
2 changes: 1 addition & 1 deletion README.md
Original file line number Diff line number Diff line change
Expand Up @@ -60,7 +60,7 @@
|---|---|---|
|setBannerStyle(int bannerStyle)| 设置轮播样式(默认为CIRCLE_INDICATOR)|无
|setIndicatorGravity(int type)| 设置指示器位置(没有标题默认为右边,有标题时默认左边)|无
|isAutoPlay(boolean isAutoPlay)| 设置是否自动轮播(默认自动)|1.3.3结束
|isAutoPlay(boolean isAutoPlay)| 设置是否自动轮播(默认自动)|
|startAutoPlay()|开始轮播|1.4开始,此方法只作用于banner加载完毕-->需要在start()后执行
|stopAutoPlay()|结束轮播|1.4开始,此方法只作用于banner加载完毕-->需要在start()后执行
|start()|开始进行banner渲染|1.4开始
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -9,12 +9,9 @@
import com.youth.banner.loader.ImageLoader;


public class CustomImageLoader extends ImageLoader {
public class FrescoImageLoader extends ImageLoader {
@Override
public void displayImage(Context context, Object path, ImageView imageView) {
//具体方法内容自己去选择,次方法是为了减少banner过多的依赖第三方包,所以将这个权限开放给使用者去选择
// Glide.with(context).load(path).into(imageView);

//用fresco加载图片
Uri uri = Uri.parse((String) path);
imageView.setImageURI(uri);
Expand Down
18 changes: 18 additions & 0 deletions app/src/main/java/com/test/banner/GlideImageLoader.java
Original file line number Diff line number Diff line change
@@ -0,0 +1,18 @@
package com.test.banner;

import android.content.Context;
import android.net.Uri;
import android.widget.ImageView;

import com.bumptech.glide.Glide;
import com.facebook.drawee.view.SimpleDraweeView;
import com.youth.banner.loader.ImageLoader;


public class GlideImageLoader extends ImageLoader {
@Override
public void displayImage(Context context, Object path, ImageView imageView) {
//具体方法内容自己去选择,次方法是为了减少banner过多的依赖第三方包,所以将这个权限开放给使用者去选择
Glide.with(context).load(path).into(imageView);
}
}
7 changes: 2 additions & 5 deletions app/src/main/java/com/test/banner/MainActivity.java
Original file line number Diff line number Diff line change
@@ -1,6 +1,5 @@
package com.test.banner;

import android.content.Intent;
import android.os.Bundle;
import android.os.Handler;
import android.support.v4.widget.SwipeRefreshLayout;
Expand All @@ -15,8 +14,6 @@

import com.test.banner.common.BaseRecyclerAdapter;
import com.youth.banner.Banner;
import com.youth.banner.BannerConfig;
import com.youth.banner.Transformer;
import com.youth.banner.listener.OnBannerClickListener;

import java.util.Arrays;
Expand Down Expand Up @@ -71,12 +68,12 @@ protected void onCreate(Bundle savedInstanceState) {
*/

//简单使用
banner.setImages(Arrays.asList(images)).setImageLoader(new CustomImageLoader()).start();
banner.setImages(Arrays.asList(images)).setImageLoader(new FrescoImageLoader()).start();
/*
//设置banner样式
banner.setBannerStyle(BannerConfig.CIRCLE_INDICATOR_TITLE_INSIDE);
//设置图片加载器
banner.setImageLoader(new CustomImageLoader());
banner.setImageLoader(new FrescoImageLoader());
//设置图片集合
banner.setImages(Arrays.asList(images));
//设置banner动画效果
Expand Down

0 comments on commit b07ea31

Please sign in to comment.