com.youth.banner.Banner.setImages()方法的使用及代码示例

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

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

Banner.setImages介绍

暂无

代码示例

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

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

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

Banner banner = (Banner) header;
banner.setImageLoader(new GlideImageLoader());
banner.setImages(BANNER_ITEMS);
banner.start();
mAdapter.addHeaderView(banner);

代码示例来源:origin: sdwfqin/AndroidSamples

public void bindData() {
    // banner图片
    List<String> imgs = new LinkedList<>();
    imgs.add("https://timgsa.baidu.com/timg?image&quality=80&size=b9999_10000&sec=1498471769363&di=cd41ec2c450f3da07a11cf378fd47dfb&imgtype=0&src=http%3A%2F%2Fwww.1tong.com%2Fuploads%2Fwallpaper%2Flandscapes%2F273-1-1920x1200.jpg");
    imgs.add("https://timgsa.baidu.com/timg?image&quality=80&size=b9999_10000&sec=1498471769361&di=3e0b350eecc9655fb72a7c1da7970245&imgtype=0&src=http%3A%2F%2Fimgsrc.baidu.com%2Fimgad%2Fpic%2Fitem%2Ff7246b600c338744af80e6575b0fd9f9d72aa050.jpg");
    imgs.add("https://timgsa.baidu.com/timg?image&quality=80&size=b9999_10000&sec=1499066949&di=5ac6694646dd38015675ccaa28cea326&imgtype=jpg&er=1&src=http%3A%2F%2Fwww.bz55.com%2Fuploads%2Fallimg%2F150317%2F140-15031G04118-50.jpg");
    imgs.add("https://timgsa.baidu.com/timg?image&quality=80&size=b9999_10000&sec=1498472230107&di=339698d9da2f4e18e2bd23ebeb0a5cd7&imgtype=0&src=http%3A%2F%2Fimage227-c.poco.cn%2Fmypoco%2Fmyphoto%2F20140730%2F09%2F17362892420140730095950014_440.jpg%3F1024x763_120");
    imgs.add("https://timgsa.baidu.com/timg?image&quality=80&size=b9999_10000&sec=1498472230093&di=285b7c5376e001dc3cab281aefbf5f7f&imgtype=0&src=http%3A%2F%2Fimg.pconline.com.cn%2Fimages%2Fupload%2Fupc%2Ftx%2Fitbbs%2F1409%2F08%2Fc3%2F38363133_1410144825921.jpg");
    //设置图片加载器
    banner.setImageLoader(new GlideImageLoader());
    //设置图片集合
    banner.setImages(imgs);
    //banner设置方法全部调用完毕时最后调用
    banner.start();
  }
}

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

@Override
public void showBanner(List<com.itculturalfestival.smartcampus.entity.db.Banner> bannerList) {
  imgs.clear();
  titles.clear();
  this.bannerList.clear();
  if (bannerList != null) {
    this.bannerList.addAll(bannerList);
    for (com.itculturalfestival.smartcampus.entity.db.Banner banner : bannerList) {
      imgs.add(banner.getImgUrl());
      titles.add(banner.getTitle());
    }
  }
  banner.setImages(imgs);
  banner.setBannerTitles(titles);
  banner.start();
}

代码示例来源:origin: ysnows/DoubleScrollVIew

@Override
public void onViewCreated(View view, @Nullable Bundle savedInstanceState) {
  super.onViewCreated(view, savedInstanceState);
  banner = (Banner) view.findViewById(R.id.banner);
  pageOne = (Page) view.findViewById(R.id.pageOne);
  container = (PageContainer) view.findViewById(R.id.container);
  banner.setImages(list).setImageLoader(new GlideImageLoader()).start();
  webview = (WebView) view.findViewById(R.id.webview);
  webview.loadUrl("https://github.com/ysnows");
  PageContainer pageContainer = (PageContainer) view.findViewById(R.id.container);
  pageContainer.setOnPageChanged(new PageBehavior.OnPageChanged(){
    @Override
    public void toTop() {
      //位于第一页
    }
    @Override
    public void toBottom() {
      //位于第二页
    }
  });
}

代码示例来源: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: ximsfei/Skin-Demo

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: gaolhjy/enjoyshop

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

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

/**
 * 简单使用
 */
private void easyUse() {
  //设置图片加载器
  banner.setImageLoader(new GlideImageLoader());
  //设置图片集合
  banner.setImages(images);
  //banner设置方法全部调用完毕时最后调用
  banner.start();
}

代码示例来源: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: 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: dom4j1/Red

@Override
public void showDailyList(HomeListBean data) {
  if (mSwipRefresh.isRefreshing()) {
    mSwipRefresh.setRefreshing(false);
  }
  mBanner.setVisibility(View.VISIBLE);
  mTitles.clear();
  mUrls.clear();
  mTime.setText("今日热闻");
  mStories = data.getStories();
  List<HomeListBean.TopStoriesBean> top_stories = data.getTop_stories();
  for (HomeListBean.TopStoriesBean bean : top_stories) {
    mUrls.add(bean.getImage());
    mTitles.add(bean.getTitle());
  }
  mAdapter.setDataList(mStories);
  mBanner.setImages(mUrls);
  mBanner.setBannerTitles(mTitles);
  mBanner.start();
  mRecyclerView.setAdapter(mAdapter);
}

代码示例来源: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: yoyiyi/bilisoleil

@Override
public void onBindHeaderViewHolder(ViewHolder holder) {
  Banner bannar = holder.getView(R.id.banner);
  List<String> urls = Stream.of(mList).map(bannerBean -> bannerBean.image).collect(Collectors.toList());
  bannar.setIndicatorGravity(BannerConfig.RIGHT)
      .setImages(urls)
      .setImageLoader(new GlideImageLoader())
      .start();
  bannar.setOnBannerListener(i -> {
    RegionRecommend.BannerBean.TopBean bannerBean = mList.get(i);
    BrowerActivity.startActivity(mContext,bannerBean.uri,bannerBean.title,bannerBean.image);
  });
}

代码示例来源:origin: yoyiyi/bilisoleil

@Override
public void onBindHeaderViewHolder(ViewHolder holder) {
  Banner banner = holder.getView(R.id.banner);
  List<String> urls = Stream.of(mList).map(bannerBean -> bannerBean.img).collect(Collectors.toList());
  banner.setIndicatorGravity(BannerConfig.RIGHT)
      .setImages(urls)
      .setImageLoader(new GlideImageLoader())
      .start();
  banner.setOnBannerListener(i -> {
    LivePartition.BannerBean bannerBean = mList.get(i);
    BrowerActivity.startActivity(mContext,bannerBean.link,bannerBean.title,bannerBean.img);
  });
}

代码示例来源: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();
}

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

banner.setImages(images);

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

private void initBanner() {
  banner = (Banner) findViewById(R.id.banner);
  //设置banner样式
  banner.setBannerStyle(BannerConfig.NUM_INDICATOR_TITLE);
  //设置图片加载器
  banner.setImageLoader(new GlideImageLoader());
  //设置图片集合
  List<String> title = LibraryPictureUtil.get_library_pic_title();
  List<String> url = LibraryPictureUtil.get_library_picture_url();
  banner.setImages(url);
  //设置banner动画效果
  banner.setBannerAnimation(Transformer.Default);
  //设置标题集合(当banner样式有显示title时)
  banner.setBannerTitles(title);
  //设置自动轮播,默认为true
  banner.isAutoPlay(true);
  //设置轮播时间
  banner.setDelayTime(3000);
  //设置指示器位置(当banner模式中有指示器时)
  banner.setIndicatorGravity(BannerConfig.CENTER);
  //banner设置方法全部调用完毕时最后调用
  banner.start();
}

相关文章