横向滑动HorizontalScrollView+Gridview
来源:互联网 发布:科学计算 python 编辑:程序博客网 时间:2024/05/21 22:51
布局xml:
<RelativeLayout
android:layout_width="match_parent"
android:layout_height="wrap_content"
android:background="@color/classify_bg"
android:paddingBottom="6dp"
android:paddingTop="6dp" >
<ImageView
android:id="@+id/left_iv"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:layout_centerVertical="true"
android:layout_marginLeft="10dp"
android:layout_marginRight="4dp"
android:layout_alignParentLeft="true"
android:clickable="true"
android:src="@drawable/category_left" />
<ImageView
android:id="@+id/right_iv"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:layout_marginRight="10dp"
android:layout_marginLeft="4dp"
android:layout_alignParentRight="true"
android:layout_centerVertical="true"
android:clickable="true"
android:src="@drawable/category_right" />
<HorizontalScrollView
android:layout_width="fill_parent"
android:layout_height="wrap_content"
android:layout_toLeftOf="@+id/right_iv"
android:layout_toRightOf="@+id/left_iv"
android:layout_centerVertical="true"
android:overScrollMode="never"
android:fadingEdge="none"
android:scrollbars="none" >
<LinearLayout
android:layout_width="match_parent"
android:layout_height="wrap_content"
android:orientation="horizontal" >
<GridView
android:id="@+id/top_classify"
android:layout_width="match_parent"
android:layout_height="wrap_content"
android:listSelector="#00000000"
android:fadingEdge="none" />
</LinearLayout>
</HorizontalScrollView>
</RelativeLayout>
关键代码:
private void setGridParamer(List<InfoCatModel> result) {
DisplayMetrics dm = new DisplayMetrics();
getWindowManager().getDefaultDisplay().getMetrics(dm);
LayoutParams params = new LayoutParams(result.size() * (120 + 6),
LayoutParams.WRAP_CONTENT);
gridView.setLayoutParams(params);
gridView.setColumnWidth(120);
gridView.setHorizontalSpacing(6);
gridView.setStretchMode(GridView.NO_STRETCH);
gridView.setNumColumns(result.size());
}
- 横向滑动HorizontalScrollView+Gridview
- HorizontalScrollView嵌套GridView实现横向滑动
- HorizontalScrollView 和GridView 实现横向滑动
- android 横向滑动 HorizontalScrollView
- HorizontalScrollView横向滑动
- HorizontalScrollView横向滑动
- HorizontalScrollView 横向滑动菜单
- HorizontalScrollView实现listView 横向滑动
- HorizontalScrollView横向滑动静态方法
- gridview 外嵌套HorizontalScrollView 横向滑动后setselection(position)不起作用的解决方法
- GridView禁止横向滑动
- 横向滑动的GridView
- gridview横向滑动
- GridView横向滑动+预览
- GridView横向滑动+预览
- 使用HorizontalScrollView 实现ListView横向滑动
- Android 自定义 HorizontalScrollView 横向滑动效果
- 无限横向滑动菜单(自定义HorizontalScrollView+ViewPager)
- swift调用oc类文件的方法
- Web server调研分析
- achartengine画出动态折线图 zz
- apache和php的一些配置
- mysql中where or cast
- 横向滑动HorizontalScrollView+Gridview
- 怎么样进行拓扑排序
- leetcode 149: Copy List with Random Pointer
- 用poi导出Excel
- QT子线程与主线程的信号槽通信
- Linux C语言编程学习材料
- PRML线性模型小结
- 自定义下拉框
- HDU 4101 Ali and Baba