android横向循环自动滚动
来源:互联网 发布:ck手表知乎 编辑:程序博客网 时间:2024/05/19 17:09
项目需要实现GridView横向循环自动滚动
1、先看布局
<HorizontalScrollView android:layout_width="fill_parent" android:layout_height="wrap_content" android:scrollbars="none" android:id="@+id/horizontalscrollview"> <LinearLayout android:layout_width="fill_parent" android:layout_height="wrap_content" android:orientation="horizontal" > <GridView android:id="@+id/gridview_ad" android:layout_width="wrap_content" android:layout_height="wrap_content" android:gravity="center" android:horizontalSpacing="3dip" android:listSelector="@color/white" android:numColumns="6" android:padding="5dip" android:scrollbars="none" android:verticalSpacing="5dip" /> </LinearLayout> </HorizontalScrollView>
看怎么循环自动
Handler Timerhandler = new Handler();Runnable runnable = new Runnable() {@Overridepublic void run() {int off = horizontalscrollview.getScrollX()- horizontalscrollview.getMeasuredWidth(); // 计算移动量if (off <= 0) {horizontalscrollview.smoothScrollTo(horizontalscrollview.getMeasuredWidth() * 2, 0);} else {horizontalscrollview.smoothScrollTo(0, 0);}Timerhandler.postDelayed(this, 5000);}};
horizontalscrollview.smoothScrollTo(0, 0);
0 0
- android横向循环自动滚动
- Android 自动滚动循环轮播图
- Android 循环自动滚动广告
- Android TextView文字横向自动滚动(跑马灯)
- Android TextView文字横向自动滚动(跑马灯)
- Android TextView文字横向自动滚动(跑马灯)
- Android TextView文字横向自动滚动(跑马灯)
- Android TextView文字横向自动滚动(跑马灯)
- Android TextView文字横向自动滚动(跑马灯)
- Android TextView文字横向自动滚动…
- Android TextView文字横向自动滚动(跑马灯)
- Android:TextView文字横向自动滚动(跑马灯)
- Android TextView文字横向自动滚动(跑马灯)
- 【Android】GridView 横向滚动
- android listview 横向滚动
- TextView文字横向自动滚动
- 横向ListView的自动滚动
- 图片横向自动滚动显示
- 两分钟彻底让你明白Android中onInterceptTouchEvent与onTouchEvent(图文)!
- struts2,hibernate4,spring3配置时问题汇总及解决办法
- Gmail 的一千种活法 [ 不完全指南二 ]
- JAVA枚举
- C# Trie树工具类
- android横向循环自动滚动
- PHP截取字符串
- jsoncpp 库的使用方法
- go工程结构
- QT实现图片按钮
- iOS UILabel显示HTML文本
- PHP中CURL方法curl_setopt()函数的一些参数
- css3中的content和实体
- Java web----JSP