zoukankan      html  css  js  c++  java
  • 横向 gridView 一行 滚动

    引用:http://www.eoeandroid.com/thread-14382-2-1.html

    <HorizontalScrollView android:id="@+id/hsView"
            android:layout_width="fill_parent" android:layout_height="wrap_content" 
            android:visibility="gone"  android:background="#E9E9E9">
                <LinearLayout
                    android:layout_width="fill_parent"  android:layout_height="wrap_content" 
                    android:orientation="horizontal">
                    <GridView  android:id="@+id/gridView"
                        android:layout_width="fill_parent" android:layout_height="wrap_content" />
                </LinearLayout>
        </HorizontalScrollView>
    ----------------------------------------------------------------------
    MainActivity.java

      LayoutParams params = new LayoutParams(videoList.size() * (columnWidth+horizontalSpacing),LayoutParams.WRAP_CONTENT);
        gridView.setLayoutParams(params);    //gridView的整体宽度
        gridView.setColumnWidth(360);   //列宽(像素)
        gridView.setHorizontalSpacing(4);  //水平间距
        gridView.setStretchMode(GridView.NO_STRETCH);   //不拉伸
        gridView.setNumColumns(videoList.size());      //一排显示几列

  • 相关阅读:
    螺旋矩阵算法
    shell脚本编程的10个最佳实践
    时间字符串转长整形数
    python的发音
    wget使用技巧
    History命令用法15例
    14位格式时间字符串
    Spring MVC
    Android SQLite数据储存方式
    MYSQL命令大全
  • 原文地址:https://www.cnblogs.com/sode/p/2177735.html
Copyright © 2011-2022 走看看