广告图-轮播图
来源:互联网 发布:淘宝联盟手机教程 编辑:程序博客网 时间:2024/04/29 21:44
//容纳圆点的容器
private LinearLayout ll_container;
//滚动图片显示的内容
private String[] titleList={ };
//滚动图片资源
pirvate int[] imgIds = { };
//容纳图片view的集合
priavate List imageViewList;
/**容纳圆点的列表 private List points; 后面用 ll_container.getChildAt().setSelected(); 可以省写这个集合
*/
//默认显示下标为0的内容
tv_title.setText(titleList[0]);
//默认显示下标为0的view 显示中间的图片,再减去取余的值,正好下标为0
viewPager.setCurrentItem(Integer.MAX_VALUE/2 - Integer.MAX_VALUE / 2 % imageViewList.size())
//设置数据
initData(){
//创建圆点
Imagview view = new ImageView(this);
//(注意,如果使用选择器的话)要给创建的view添加状态选择器
view.setBackgroundResource(R.drawable.selector_view_bg);
if(i == 0){
view.setSelected(true);
}else{
}
//然后就是LayoutParams类 ,setMargins(), addView()
}
//设置适配器
return Integer.MAX_VALUE;
instanItem(){
//所有的position都要取余
position = Integer.MAX_VALUE % imageViewList.size();
View view = imageViewList.get(position )
return position
}
//设置监听
setonPagechangeListener(){
onPageSelected(){
//定义一个int lastPostion = 0;
position = Integer.MAX_VALUE % imageViewList.size();
ll_container.getChildAt(position).setSelected(true);
ll_container.getChildAt(lastPosition).setSelected(true);
lastPostion = position;
//注意发送广播不是写在监听里面,应该写到onCreate方法里面
}
}
然后:
if(isRunnig){
viewPager.setCurrentItem(viewPager.getCurrentItem() + 1);
handler.sendEmptyMessageDelayed(FLUSH,2000);
}
- iOS轮播图广告图
- iOS轮播图广告图
- 广告图-轮播图
- 广告轮播图
- 广告轮播图
- 广告轮播图
- 广告轮播图
- 广告轮播图
- 轮播图广告
- 安卓广告轮播图
- Android 自动广告轮播图
- Android 广告轮播图
- iOS 广告轮播图
- 安卓版广告条,轮播图
- Android广告轮播图实现
- RecyclerView实现广告轮播图
- APP广告轮播图效果
- js横幅广告轮播图
- android 6.0 权限简述、思路分析和代码实践
- mui 底部导航菜单功能(原创)
- Python代码调试问题:IOError: cannot identify image file
- 《C++Primer》读书笔记——第14章 重载运算与类型转换
- UVALive 6624 Card Trick (概率DP)
- 广告图-轮播图
- 面试题 String类
- 《C++Primer》读书笔记——第15章 面向对象程序设计
- node.js第一课 搭建一个简易网站项目
- Android视图动画
- LintCode:最小差
- linux0.01编译出的Image核心文件的启动方法
- py-faster-rcnn源码解读系列(四)——anchor_target_layer.py
- avd创建模拟器的时候提示emulator.exe已停止运行