【问题标题】:How can i have horizontal listView or gridView with manual control我怎样才能有手动控制的水平listView或gridView
【发布时间】:2013-11-03 10:57:25
【问题描述】:

我正在开发一个应用程序,它需要像旧的Gallery 这样的东西,但它不需要是可滚动的......相反,它应该使用两个控制元素 imageButtons ,如您所见在图片中,用于平滑滚动到下一个或上一个位置。我在我的 XML 中创建了一个 gridView:

            <GridView
            android:id="@+id/gridView2"
            android:background="#E4E4E4"
            android:layout_width="fill_parent"
            android:layout_height="180dp"
            android:columnWidth="90dp"
            android:gravity="right"
            android:horizontalSpacing="10dp"
            android:numColumns="12"
            android:stretchMode="none"
            android:verticalSpacing="10dp"
            android:layout_marginTop="4dp"
            android:layout_marginBottom="4dp"
            android:layout_marginLeft="4dp"
            android:layout_marginRight="4dp" >
        </GridView>

但 smoothScrollToPosition 方法只改变行,不改变列。我的意思是,如果我在这个网格中有 30 个元素,它在前 12 步(numColumns="12")中不会做任何事情,然后在第 13 步中它会平滑滚动到下一行。 linearView 和一堆图像可以正常工作,但是 linearView 没有方法来改变它的孩子的位置,比如 smoothScrollToPosition 对 listView 和 gridView 谢谢...

【问题讨论】:

标签: android android-layout listview gridview android-gallery


【解决方案1】:

我很确定你可以用 HorizontalScrollView 解决它 使用 smoothScrollTo 或其他可用函数进行滚动

【讨论】:

    猜你喜欢
    • 2011-06-08
    • 1970-01-01
    • 2013-12-26
    • 1970-01-01
    • 1970-01-01
    • 1970-01-01
    • 2016-11-25
    • 1970-01-01
    • 1970-01-01
    相关资源
    最近更新 更多