本文整理汇总了Java中com.youth.banner.BannerConfig类的典型用法代码示例。如果您正苦于以下问题:Java BannerConfig类的具体用法?Java BannerConfig怎么用?Java BannerConfig使用的例子?那么, 这里精选的类代码示例或许可以为您提供帮助。
BannerConfig类属于com.youth.banner包,在下文中一共展示了BannerConfig类的15个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的Java代码示例。
示例1: inithead
import com.youth.banner.BannerConfig; //导入依赖的package包/类
private void inithead(List<TopStories> topStories) {
this.topStories = topStories;
List<String> titles = new ArrayList<>();
for (int i = 0; i < topStories.size(); i++) {
titles.add(topStories.get(i).getTitle());
}
banner.setBannerTitles(titles);
// banner.setBannerStyle(BannerConfig.CIRCLE_INDICATOR_TITLE);
//设置图片加载器
banner.setImageLoader(new GlideImageLoader());
//设置banner动画效果
banner.setBannerAnimation(Transformer.Default);
//设置自动轮播,默认为true
banner.isAutoPlay(true);
//设置轮播时间
banner.setDelayTime(5000);
//设置指示器位置(当banner模式中有指示器时)
banner.setIndicatorGravity(BannerConfig.CENTER);
//设置图片集合
banner.setImages(topStories);
//banner设置方法全部调用完毕时最后调用
banner.start();
}
示例2: onItemSelected
import com.youth.banner.BannerConfig; //导入依赖的package包/类
@Override
public void onItemSelected(AdapterView<?> parent, View view, int position, long id) {
switch (position){
case 0:
banner.updateBannerStyle(BannerConfig.NOT_INDICATOR);
break;
case 1:
banner.updateBannerStyle(BannerConfig.CIRCLE_INDICATOR);
break;
case 2:
banner.updateBannerStyle(BannerConfig.NUM_INDICATOR);
break;
case 3:
banner.updateBannerStyle(BannerConfig.NUM_INDICATOR_TITLE);
break;
case 4:
banner.updateBannerStyle(BannerConfig.CIRCLE_INDICATOR_TITLE);
break;
case 5:
banner.updateBannerStyle(BannerConfig.CIRCLE_INDICATOR_TITLE_INSIDE);
break;
}
}
示例3: onCreate
import com.youth.banner.BannerConfig; //导入依赖的package包/类
@Override
protected void onCreate(Bundle savedInstanceState) {
super.onCreate(savedInstanceState);
setContentView(R.layout.activity_custom_banner);
banner1 = (Banner) findViewById(R.id.banner1);
banner2 = (Banner) findViewById(R.id.banner2);
banner3 = (Banner) findViewById(R.id.banner3);
banner1.setImages(App.images)
.setImageLoader(new GlideImageLoader())
.start();
banner2.setImages(App.images)
.setImageLoader(new GlideImageLoader())
.start();
banner3.setImages(App.images)
.setBannerTitles(App.titles)
.setBannerStyle(BannerConfig.CIRCLE_INDICATOR_TITLE_INSIDE)
.setImageLoader(new GlideImageLoader())
.start();
}
示例4: initBanner
import com.youth.banner.BannerConfig; //导入依赖的package包/类
private void initBanner(){
Integer[] images = new Integer[]{
R.drawable.banner0,
R.drawable.common_background,
R.drawable.banner2,
R.drawable.banner3
};
String[] titles = new String[]{"济南城市热点宣传","城市热点宣传片","精彩嘎纳湖","英超!英超!goal!goal!"};
banner.setImageLoader(new ImageLoader() {
@Override
public void displayImage(Context context, Object path, ImageView imageView) {
// Glide.with(context).load((int)path).into(imageView);
imageView.setImageResource((int)path);
}
}).setImages(Arrays.asList(images))
.setBannerTitles(Arrays.asList(titles))
.setBannerStyle(BannerConfig.CIRCLE_INDICATOR_TITLE_INSIDE)
.start();
}
示例5: setFirstPage
import com.youth.banner.BannerConfig; //导入依赖的package包/类
private void setFirstPage(List<IndexList.TopStoriesBean> top_stories, List<IndexList.StoriesBean> stories) {
if (stories.isEmpty()) {
mStatusLayout.showEmpty();
} else {
mStatusLayout.showContent();
}
adapter.updateData(stories);
List<String> imList = new ArrayList<>();
List<String> titleList = new ArrayList<>();
for (IndexList.TopStoriesBean bean : top_stories) {
imList.add(bean.getImage());
titleList.add(bean.getTitle());
}
banner.update(imList, titleList);
banner.setBannerStyle(BannerConfig.CIRCLE_INDICATOR_TITLE_INSIDE);
banner.start();
banner.setOnBannerListener(position -> {
int id = top_stories.get(position).getId();
int type = top_stories.get(position).getType();
if (type == 0) {
DetailDefaultActivity.onToDetailPage(mActivity, id, banner);
} else {
DetailOtherActivity.onToDetailPage(mActivity, id, type);
}
});
}
示例6: onCreate
import com.youth.banner.BannerConfig; //导入依赖的package包/类
@Override
protected void onCreate(Bundle savedInstanceState) {
super.onCreate(savedInstanceState);
setContentView(R.layout.activity_banner_style);
banner = (Banner) findViewById(R.id.banner);
spinnerStyle = (Spinner) findViewById(R.id.spinnerStyle);
spinnerStyle.setOnItemSelectedListener(this);
//默认是CIRCLE_INDICATOR
banner.setImages(App.images)
.setBannerTitles(App.titles)
.setBannerStyle(BannerConfig.NOT_INDICATOR)
.setImageLoader(new GlideImageLoader())
.start();
}
示例7: onItemSelected
import com.youth.banner.BannerConfig; //导入依赖的package包/类
@Override
public void onItemSelected(AdapterView<?> parent, View view, int position, long id) {
switch (position) {
case 0:
banner.setIndicatorGravity(BannerConfig.LEFT);
break;
case 1:
banner.setIndicatorGravity(BannerConfig.CENTER);
break;
case 2:
banner.setIndicatorGravity(BannerConfig.RIGHT);
break;
}
banner.start();
}
示例8: initView
import com.youth.banner.BannerConfig; //导入依赖的package包/类
private void initView(View view) {
mToolBar = (CNiaoToolBar) view.findViewById(R.id.toolbar);
mToolBar.setOnClickListener(this);
mBanner = (Banner) view.findViewById(R.id.banner);
//设置banner样式
mBanner.setBannerStyle(BannerConfig.CIRCLE_INDICATOR_TITLE);
//设置图片加载器
mBanner.setImageLoader(new GlideImageLoader());
mRecyclerView = (RecyclerView) view.findViewById(R.id.recyclerview);
}
示例9: setBannerData
import com.youth.banner.BannerConfig; //导入依赖的package包/类
/**
* 轮播图数据
*/
private void setBannerData() {
//设置图片集合
mBanner.setImages(images);
//设置标题集合(当banner样式有显示title时)
mBanner.setBannerTitles(titles);
//设置指示器位置(当banner模式中有指示器时)
mBanner.setIndicatorGravity(BannerConfig.CENTER);
mBanner.start();
}
示例10: initBanner
import com.youth.banner.BannerConfig; //导入依赖的package包/类
private void initBanner() {
List<Integer> images = new ArrayList<>();
images.add(R.drawable.banner01);
images.add(R.drawable.banner02);
images.add(R.drawable.banner03);
images.add(R.drawable.banner04);
images.add(R.drawable.bnaner05);
images.add(R.drawable.banner06);
//设置banner样式
mBanner.setBannerStyle(BannerConfig.CIRCLE_INDICATOR);
// 设置图片加载器
mBanner.setImageLoader(new GlideImageLoader());
//设置图片集合
mBanner.setImages(images);
//设置banner动画效果
mBanner.setBannerAnimation(Transformer.DepthPage);
//设置标题集合(当banner样式有显示title时)
//banner.setBannerTitles(titles);
//设置自动轮播,默认为true
mBanner.isAutoPlay(true);
//设置轮播时间
mBanner.setDelayTime(2000);
//设置指示器位置(当banner模式中有指示器时)
mBanner.setIndicatorGravity(BannerConfig.CENTER);
//banner设置方法全部调用完毕时最后调用
mBanner.start();
}
示例11: setupRecyclerViewHeader
import com.youth.banner.BannerConfig; //导入依赖的package包/类
/**
* 配置recyclerView头部轮播
*/
private void setupRecyclerViewHeader(Banner banner) {
List<String> images = new ArrayList<>();
List<String> titles = new ArrayList<>();
for (ArticleListBean bean :
mIsGoodArticleBeans) {
images.add(bean.getTitlepic());
titles.add(bean.getTitle());
}
banner.setLayoutParams(new FrameLayout.LayoutParams(ViewGroup.LayoutParams.MATCH_PARENT, (int) (SizeUtils.getScreenHeightPx(mContext) * 0.3)));
// 配置banner
banner.setBannerStyle(BannerConfig.CIRCLE_INDICATOR_TITLE_INSIDE)
.setImageLoader(new FrescoImageLoader())
.setImages(images)
.setBannerTitles(titles)
.isAutoPlay(true)
.setDelayTime(5000)
.setBannerAnimation(Transformer.Default)
.setIndicatorGravity(BannerConfig.RIGHT)
.start();
// 监听banner点击事件
banner.setOnBannerClickListener(new OnBannerClickListener() {
// position 从1开始
@Override
public void OnBannerClick(int position) {
if (mOnItemTapListener != null) {
mOnItemTapListener.onItemTapListener(mIsGoodArticleBeans.get(position - 1));
}
}
});
}
示例12: initBanner
import com.youth.banner.BannerConfig; //导入依赖的package包/类
/**
* 初始化banner
*/
private void initBanner() {
//设置banner样式
banner.setBannerStyle(BannerConfig.NUM_INDICATOR);
//设置图片加载器
banner.setImageLoader(new GlideImageLoader());
}
示例13: setupRecyclerViewHeader
import com.youth.banner.BannerConfig; //导入依赖的package包/类
/**
* 配置recyclerView头部轮播
*/
private void setupRecyclerViewHeader(Banner banner) {
List<String> images = new ArrayList<>();
List<String> titles = new ArrayList<>();
for (ArticleListBean bean :
isGoodArticleBeans) {
images.add(bean.getTitlepic());
titles.add(bean.getTitle());
}
banner.setLayoutParams(new FrameLayout.LayoutParams(ViewGroup.LayoutParams.MATCH_PARENT, (int) (SizeUtils.getScreenHeightPx(context) * 0.3)));
// 配置banner
banner.setBannerStyle(BannerConfig.CIRCLE_INDICATOR_TITLE_INSIDE)
.setImageLoader(new FrescoImageLoader())
.setImages(images)
.setBannerTitles(titles)
.isAutoPlay(true)
.setDelayTime(5000)
.setBannerAnimation(Transformer.Default)
.setIndicatorGravity(BannerConfig.RIGHT)
.start();
// 监听banner点击事件
banner.setOnBannerClickListener(new OnBannerClickListener() {
// position 从1开始
@Override
public void OnBannerClick(int position) {
if (onItemTapListener != null) {
onItemTapListener.onItemTapListener(isGoodArticleBeans.get(position - 1));
}
}
});
}
示例14: initBanner
import com.youth.banner.BannerConfig; //导入依赖的package包/类
/**
* 初始化广告图片
*/
private void initBanner() {
//设置图片加载器
banner.setImageLoader(new GlideImageLoader());
//设置banner样式
banner.setBannerStyle(BannerConfig.CIRCLE_INDICATOR_TITLE);
}
示例15: initView
import com.youth.banner.BannerConfig; //导入依赖的package包/类
/**
* 初始化界面控件
*/
private void initView() {
mImages.add(R.drawable.find_1);
mImages.add(R.drawable.find_2);
mImages.add(R.drawable.find_8);
mImages.add(R.drawable.find_4);
mImages.add(R.drawable.find_5);
mImages.add(R.drawable.find_6);
mImages.add(R.drawable.find_7);
mTitles.add("既见公子,云胡不喜?");
mTitles.add("我只想静静地,做个美男子。");
mTitles.add("曾经的曾经,只剩期望...");
mTitles.add("你那么美,爱我如何?");
mTitles.add("夜,夜,夜...");
mTitles.add("孩子,快点睡吧,明天还要抢票回家呢。");
mTitles.add("天边美丽的火烧云啊,我的生活放荡,像条狗,像条流浪狗...");
titleSearchIbtn = (ImageButton) view.findViewById(R.id.title_find_search_ibtn);
titleSearchIbtn.setOnClickListener(ThirdFragment.this);
nineGridView = (NineGridView) view.findViewById(R.id.find_nine_gridview);
nineGridView.setAdapter(new NineGridViewAdapter(getActivity()));
mBanner = (Banner) view.findViewById(R.id.banner);
mBanner.setBannerStyle(BannerConfig.CIRCLE_INDICATOR_TITLE_INSIDE);
mBanner.setBannerAnimation(Transformer.Default);
mBanner.isAutoPlay(true);
mBanner.setDelayTime(3000);
mBanner.setIndicatorGravity(BannerConfig.CENTER);
mBanner.setBannerTitles(mTitles);
mBanner.setImageLoader(new GlideImageLoader());
mBanner.setImages(mImages);
mBanner.start();
mBanner.setOnBannerClickListener(this);
}