本文整理汇总了Java中com.bigkoo.convenientbanner.holder.CBViewHolderCreator类的典型用法代码示例。如果您正苦于以下问题:Java CBViewHolderCreator类的具体用法?Java CBViewHolderCreator怎么用?Java CBViewHolderCreator使用的例子?那么恭喜您, 这里精选的类代码示例或许可以为您提供帮助。
CBViewHolderCreator类属于com.bigkoo.convenientbanner.holder包,在下文中一共展示了CBViewHolderCreator类的7个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的Java代码示例。
示例1: setTypeBanner
import com.bigkoo.convenientbanner.holder.CBViewHolderCreator; //导入依赖的package包/类
private void setTypeBanner(MyViewHolder myViewHolder) {
//以属性动画的形式放大
ViewPropertyAnimator.animate(myViewHolder.itemView).scaleX(1).setDuration(350).start();
ViewPropertyAnimator.animate(myViewHolder.itemView).scaleY(1).setDuration(350).start();
//自定义你的Holder,实现更多复杂的界面,不一定是图片翻页,其他任何控件翻页亦可。
myViewHolder.mConvenientBanner.setPages(
new CBViewHolderCreator<LocalImageHolderView>() {
@Override
public LocalImageHolderView createHolder() {
return new LocalImageHolderView();
}
}, mLocalImages)
//设置两个点图片作为翻页指示器,不设置则没有指示器,可以根据自己需求自行配合自己的指示器,不需要圆点指示器可用不设
.setPageIndicator(new int[]{R.drawable.page_switch_normal, R.drawable.page_switch_checked})
//设置指示器的方向
.setPageIndicatorAlign(ConvenientBanner.PageIndicatorAlign.CENTER_HORIZONTAL);
}
示例2: fillBannerData
import com.bigkoo.convenientbanner.holder.CBViewHolderCreator; //导入依赖的package包/类
@Override
public void fillBannerData(List<Banner> list) {
mBannerV.setPages(new CBViewHolderCreator<BannerViewHolder>() {
@Override
public BannerViewHolder createHolder() {
return new BannerViewHolder();
}
}, list).setPageIndicator(new int[]{R.drawable.ic_banner_indicator_unselected
, R.drawable.ic_banner_indicator_selected})
.setOnItemClickListener(new OnItemClickListener() {
@Override
public void onItemClick(int position) {
Toast.makeText(getActivity(), "你点击了" + position, Toast.LENGTH_LONG).show();
}
});
}
示例3: loadBanner
import com.bigkoo.convenientbanner.holder.CBViewHolderCreator; //导入依赖的package包/类
private void loadBanner() {
List<Integer> sliderImage = new ArrayList<>();
sliderImage.add(R.mipmap.main_back1);
sliderImage.add(R.mipmap.main_back2);
sliderImage.add(R.mipmap.main_back3);
sliderImage.add(R.mipmap.main_back4);
sliderImage.add(R.mipmap.main_back5);
dataBinding.convenientBanner.setPages(new CBViewHolderCreator() {
@Override
public Object createHolder() {
return new LocalImageHolderView();
}
}, sliderImage)
.startTurning(3000);
Class cls = null;
try {
cls = Class.forName("com.ToxicBakery.viewpager.transforms."+ZoomOutTranformer.class.getSimpleName());
ABaseTransformer transformer= (ABaseTransformer )cls.newInstance();
dataBinding.convenientBanner.getViewPager().setPageTransformer(true,transformer);
dataBinding.convenientBanner.setScrollDuration(1500);
} catch (Exception e) {
e.printStackTrace();
}
}
示例4: initConvenientBanner
import com.bigkoo.convenientbanner.holder.CBViewHolderCreator; //导入依赖的package包/类
public void initConvenientBanner() {
showView(mConvenientBanner);
// mConvenientBanner.setManualPageable(false); // 设置不能手动影响,其实就是不能手动滑动,不能按住暂停滚动
ArrayList<Integer> localImages = new ArrayList<>();
for (int position = 0; position < 4; position++)
localImages.add(getResId("ic_banner_" + position, R.mipmap.class));
mConvenientBanner.setPages(new CBViewHolderCreator<LocalImageHolderView>() {
@Override
public LocalImageHolderView createHolder() {
return new LocalImageHolderView();
}
}, localImages)
// 设置两个点图片作为翻页指示器,不设置则没有指示器,可以根据自己需求自行配合自己的指示器,不需要圆点指示器可以不设
.setPageIndicator(new int[]{R.mipmap.ic_page_indicator, R.mipmap.ic_page_indicator_focused});
// .setPageIndicatorAlign(ConvenientBanner.PageIndicatorAlign.ALIGN_PARENT_RIGHT) // 设置指示器的位置,可左可右,目前居中
// .setOnPageChangeListener(this)// 监听翻页事件
// .setOnItemClickListener(this) // 监听图片的点击事件
try {
// 设置翻页动画
PageTransformer pageTransformer = TRANSFORM_CLASSES.get(CURRENT_TRANSFORMER).clazz.newInstance();
mConvenientBanner.getViewPager().setPageTransformer(true, pageTransformer);
// 这个3D特效需要调整滑动速度
if (pageTransformer.toString().equals("StackTransformer")) {
mConvenientBanner.setScrollDuration(1200);
}
} catch (Exception e) {
throw new RuntimeException(e);
}
}
示例5: onBindView
import com.bigkoo.convenientbanner.holder.CBViewHolderCreator; //导入依赖的package包/类
@Override
public void onBindView(View headerView) {
convenientBanner.setPages(new CBViewHolderCreator() {
@Override
public Holder<Banner> createHolder() {
return new ImageHolder();
}
},listBanner)
.setPageIndicator(new int[]{R.drawable.ic_dot_normal,R.drawable.ic_dot_pressed})
.setPageIndicatorAlign(ConvenientBanner.PageIndicatorAlign.CENTER_HORIZONTAL);
if(!convenientBanner.isTurning()){
convenientBanner.startTurning(4000);
}
}
示例6: setBannerData
import com.bigkoo.convenientbanner.holder.CBViewHolderCreator; //导入依赖的package包/类
public void setBannerData(List<TopStories> data) {
banner.setPages(new CBViewHolderCreator<ZhiHuTopBannerView>() {
@Override
public ZhiHuTopBannerView createHolder() {
return new ZhiHuTopBannerView();
}
}, data);
}
示例7: setBanner
import com.bigkoo.convenientbanner.holder.CBViewHolderCreator; //导入依赖的package包/类
/**
* 设置Banner
*/
public void setBanner(){
banner.setPages(new CBViewHolderCreator<NetworkHolder>() {
@Override
public NetworkHolder createHolder() {
return new NetworkHolder();
}
},imageUrls);
banner.getViewPager().setPageTransformer(true,new StackTransformer());
}