com.youth.banner.Banner类的使用及代码示例

x33g5p2x  于2022-01-16 转载在 其他  
字(9.5k)|赞(0)|评价(0)|浏览(159)

本文整理了Java中com.youth.banner.Banner类的一些代码示例,展示了Banner类的具体用法。这些代码示例主要来源于Github/Stackoverflow/Maven等平台,是从一些精选项目中提取出来的代码,具有较强的参考意义,能在一定程度帮忙到你。Banner类的具体详情如下:
包路径:com.youth.banner.Banner
类名称:Banner

Banner介绍

暂无

代码示例

代码示例来源:origin: scwang90/SmartRefreshLayout

banner.setImageLoader(new BannerImageLoader());
banner.setImages(Arrays.asList(image_weibo_home_2,gif_header_repast));
banner.start();

代码示例来源:origin: yaozs/YzsLib

banner.setBannerStyle(BannerConfig.NUM_INDICATOR);
banner.setImageLoader(new GlideImageLoader());
banner.setImages(images);
banner.setBannerAnimation(Transformer.DepthPage);
banner.isAutoPlay(true);
banner.setDelayTime(1500);
banner.setIndicatorGravity(BannerConfig.CENTER);
banner.setOnBannerListener(new OnBannerListener() {
  @Override
  public void OnBannerClick(int position) {
banner.start();

代码示例来源:origin: fangxiaogang/WanAndroidxg

@Override
public void setBannerdate(final List<Banner> bannerers) {
  List<String> images = new ArrayList();
  for(Banner banner : bannerers){
    images.add(banner.getImagePath());
  }
  mbanner.setImages(images)
      .setImageLoader(new GlideImageLoader())
      .start();
  mbanner.setOnBannerListener(new OnBannerListener() {
    @Override
    public void OnBannerClick(int position) {
      ((MainFragment) getParentFragment()).startBrotherFragment(WebcontentFragment.newInstance(bannerers.get(position).getUrl(),bannerers.get(position).getTitle(),bannerers.get(position).getId(),false));
    }
  });
}

代码示例来源:origin: AdleyLong/RecyclerViewDemo

.setBannerStyle(BannerConfig.CIRCLE_INDICATOR_TITLE_INSIDE)
.setBannerTitles(titles)
.setImageLoader(new PicassoImageLoader())
.setImages(urls)
.setDelayTime(2000)
.setIndicatorGravity(BannerConfig.RIGHT)
.setOnBannerClickListener(new OnBannerClickListener() {
  @Override
  public void OnBannerClick(int position) {
.start();

代码示例来源:origin: laotan7237/EasyReader

private void initBanner(final List<DailyListBean.TopStoriesBean> topStoriesList) {
  banner.startAutoPlay();
  banner.setDelayTime(3000);
  List<String> imageList = new ArrayList<>();
  for (DailyListBean.TopStoriesBean topStoriesBean : topStoriesList) {
    imageList.add(topStoriesBean.getImage());
  }
  banner.setImages(imageList).setImageLoader(new GlideImageLoader()).start();
  banner.setOnBannerListener(new OnBannerListener() {
    @Override
    public void OnBannerClick(int position) {
      int id = topStoriesList.get(position).getId();
      startZhiHuDetailActivity(id, banner);
    }
  });
}

代码示例来源:origin: Jerey-Jobs/KeepGank

@Override
protected void onBindViewHolder(@NonNull final BannerHolder holder, @NonNull final BannerBean
    item) {
  List<SubjectsBean> subjects = item.getSubjects();
  List<String> imageUrls = new ArrayList<>();
  List<String> titles = new ArrayList<>();
  for (SubjectsBean s : subjects) {
    imageUrls.add(s.getImages().getLarge());
    titles.add(s.getTitle());
  }
  holder.mItemBanner.setImages(imageUrls)
      .setBannerTitles(titles)
      .setBannerStyle(BannerConfig.CIRCLE_INDICATOR_TITLE_INSIDE)
      .setImageLoader(new GlideImageLoader())
      .start();
  holder.mItemBanner.setOnBannerListener(new OnBannerListener() {
    @Override
    public void OnBannerClick(int position) {
      ARouter.getInstance()
          .build("/douban/MovieActivity")
          .withTransition(R.anim.in_from_right, 0)
          .withString("movieId", item.getSubjects().get(position).getId())
          .navigation(holder.mItemBanner.getContext());
    }
  });
}

代码示例来源:origin: wutongke/AndroidSkinAnimator

private void loadBannerAd() {
  mBannerImages.clear();
  for (int i = 0; i < BANNER_IMAGES.length; i++) {
    mBannerImages.add(BANNER_IMAGES[i]);
  }
  mHeaderBinding.banner
      .setDelayTime(5000)
      .setImages(mBannerImages)
      .setImageLoader(new ImageLoader() {
        @Override
        public void displayImage(Context context, Object path, ImageView imageView) {
          Glide.with(context).load(path)
              .crossFade(1000)
              .into(imageView);
        }
      }).start();
}

代码示例来源:origin: BolexLiu/ApkBusBlog

private void initBannerStyle() {
  //设置banner样式
  banner.setBannerStyle(BannerConfig.CIRCLE_INDICATOR_TITLE_INSIDE);
  //设置图片加载器
  banner.setImageLoader(new GlideImageLoader());
  //设置banner动画效果
  banner.setBannerAnimation(Transformer.ZoomOutSlide);
  //设置自动轮播,默认为true
  banner.isAutoPlay(true);
  //设置轮播时间
  banner.setDelayTime(3000);
  //设置指示器位置(当banner模式中有指示器时)
  banner.setIndicatorGravity(BannerConfig.CENTER);
  //banner设置方法全部调用完毕时最后调用
}

代码示例来源:origin: gaolhjy/enjoyshop

/**
 * 轮播图数据
 */
private void setBannerData() {
  //设置图片集合
  mBanner.setImages(images);
  //设置标题集合(当banner样式有显示title时)
  mBanner.setBannerTitles(titles);
  //设置指示器位置(当banner模式中有指示器时)
  mBanner.setIndicatorGravity(BannerConfig.CENTER);
  mBanner.start();
}

代码示例来源:origin: wythe0102/Mall

bannerActivity = (Banner) view.findViewById(R.id.home_activity_banner);
banner.setBannerStyle(Banner.CIRCLE_INDICATOR);
banner.setIndicatorGravity(Banner.CENTER);
banner.setDelayTime(5000);//设置轮播间隔时间
banner.setImages(images);//可以选择设置图片网址,或者资源文件,默认用Glide加载
banner.setOnBannerClickListener(new Banner.OnBannerClickListener() {//设置点击事件
  @Override
  public void OnBannerClick(View view, int position) {
bannerActivity.setBannerStyle(Banner.CIRCLE_INDICATOR);
bannerActivity.setIndicatorGravity(Banner.CENTER);
bannerActivity.setDelayTime(5000);//设置轮播间隔时间
bannerActivity.setImages(images2);//可以选择设置图片网址,或者资源文件,默认用Glide加载
bannerActivity.setOnBannerClickListener(new Banner.OnBannerClickListener() {//设置点击事件
  @Override
  public void OnBannerClick(View view, int position) {

代码示例来源:origin: jenly1314/WanAndroid

/**
 * 更新banner
 * @param data
 */
private void updateBanner(List<BannerBean> data){
  if(data!=null && data.size()>0){
    listBanner = data;
    List<String> urls = new ArrayList<>();
    List<String> titles = new ArrayList<>();
    int size = data.size();
    for (int i = 0; i < size; i++) {
      BannerBean bean = data.get(i);
      titles.add(bean.getDesc());
      urls.add(bean.getImagePath());
    }
    mBinding.banner.setVisibility(View.VISIBLE);
    mBinding.banner.setBannerTitles(titles);
    mBinding.banner.setImages(urls);
    mBinding.banner.start();
  }else{
    mBinding.banner.setVisibility(View.GONE);
  }
}

代码示例来源:origin: BolexLiu/ApkBusBlog

@Override
public void findHomeBanner(List<bolex.com.apkbus.Blog.entity.Banner> banners) {
  for (bolex.com.apkbus.Blog.entity.Banner banner : banners) {
    titles.add(banner.getTitle());
    images.add(banner.getImgUrl());
  }
  banner.setImages(images);
  banner.setBannerTitles(titles);
  banner.start();
  ViseLog.d(banners);
}

代码示例来源:origin: Vegen/SmartCampus

float marginHeight = SystemUtils.getStatusBarHeight(getContext()) + SystemUtils.getActionBarHeight(getContext());
viewTop.getLayoutParams().height = (int) marginHeight;
banner.setBannerStyle(BannerConfig.CIRCLE_INDICATOR_TITLE_INSIDE);
banner.setIndicatorGravity(BannerConfig.CENTER);
banner.setImageLoader(new GlideImageLoader());
banner.setOnBannerListener(position -> {
  if (bannerList.isEmpty()) return;
  TopFunArticleDetailActivity.start(getContext(), bannerList.get(position).getTitle(), bannerList.get(position).getNextUrl());

代码示例来源:origin: dom4j1/Red

@Override
protected void initEventAndData() {
  EventBus.getDefault().register(this);
  instance = this;
  mUrls = new ArrayList<>();
  mTitles = new ArrayList<>();
  mRecyclerView.setNestedScrollingEnabled(false);
  mLinearLayoutManager = new LinearLayoutManager(mContext);
  mRecyclerView.setLayoutManager(mLinearLayoutManager);
  mBanner.setImageLoader(new GlideImageLoader());
  mBanner.setBannerAnimation(Transformer.DepthPage);
  mBanner.setBannerStyle(BannerConfig.CIRCLE_INDICATOR_TITLE);
  mAdapter = new CommonAdapter<HomeListBean.StoriesBean>(mContext, R.layout.item_home, null) {
    @Override
    public void conver(ViewHolder viewHodler, HomeListBean.StoriesBean bean) {
      if (bean.isFlag()) {
        viewHodler.setTextColor(R.id.item_home_tv, Color.GRAY);
      } else {
        viewHodler.setTextColor(R.id.item_home_tv, Color.BLACK);
      }
      viewHodler.setText(R.id.item_home_tv, bean.getTitle())
          .loadImageFresco(R.id.item_home_sdv, bean.getImages().get(0));
      viewHodler.setOnItemClickLisenter(ZhihuDaily.this);
    }
  };
  mFab.setOnClickListener(this);
  mSwipRefresh.setOnRefreshListener(this);
  mScrollView.setOnScrollChangeListener(new OnScrllLisenter());
  mPresenter.getDailyList();
}

代码示例来源:origin: jenly1314/WanAndroid

mBinding.banner.setBannerStyle(BannerConfig.CIRCLE_INDICATOR_TITLE_INSIDE);
mBinding.banner.setImageLoader(new GlideImageLoader());
mBinding.banner.setOnBannerListener(position -> {
  if(listBanner!=null){
    BannerBean bean = listBanner.get(position);

代码示例来源:origin: gaolhjy/enjoyshop

private void initView() {
  mToolBar.setOnClickListener(this);
  //设置banner样式
  mBanner.setBannerStyle(BannerConfig.CIRCLE_INDICATOR_TITLE);
  //设置图片加载器
  mBanner.setImageLoader(new GlideImageLoader());
}

代码示例来源:origin: laotan7237/EasyReader

@Override
protected void onVisible() {
  super.onVisible();
  if (banner != null) {
    banner.start();
  }
}

代码示例来源:origin: wzmyyj/ZYMK

public void setBannerData(final List<BoBean> bos) {
    if (bos == null || bos.size() == 0) return;
    List<String> imgs = new ArrayList<>();
    List<String> strs = new ArrayList<>();

    for (int i = 0; i < bos.size(); i++) {
      BoBean bo = bos.get(i);
      imgs.add(bo.getData_src());
      strs.add(bo.getTitle());
    }
    mBanner.update(imgs, strs);

    mBanner.setOnBannerListener(new OnBannerListener() {
      @Override
      public void OnBannerClick(int position) {
        mPresenter.goDetails(bos.get(position).getHref());
      }
    });
  }
}

代码示例来源:origin: wythe0102/Mall

@Override
public void onStop() {
  super.onStop();
  banner.isAutoPlay(false);
}
@Override

代码示例来源:origin: SunAlwaysOnline/Sukeda

private void initBanner(View v, List<String> list) {
  banner = (Banner) v.findViewById(R.id.banner);
  //设置banner样式
  banner.setBannerStyle(BannerConfig.CIRCLE_INDICATOR);
  //设置指示器位置(当banner模式中有指示器时)
  banner.setIndicatorGravity(BannerConfig.CENTER);
  //设置图片加载器
  banner.setImageLoader(new GlideImageLoader());
  //设置图片集合
  banner.setImages(list);
  //设置banner动画效果
  banner.setBannerAnimation(Transformer.Default);
  //设置自动轮播,默认为true
  banner.isAutoPlay(true);
  //设置轮播时间
  banner.setDelayTime(3000);
  banner.setOnBannerListener(new OnBannerListener() {
    @Override
    public void OnBannerClick(int position) {
      com.example.bmobtest.Utils.Toast.show_info(getActivity(), "该图片不包括内容!");
    }
  });
  //banner设置方法全部调用完毕时最后调用
  banner.start();
}

相关文章