Warning: file_get_contents(/data/phpspider/zhask/data//catemap/3/android/210.json): failed to open stream: No such file or directory in /data/phpspider/zhask/libs/function.php on line 167

Warning: Invalid argument supplied for foreach() in /data/phpspider/zhask/libs/tag.function.php on line 1116

Notice: Undefined index: in /data/phpspider/zhask/libs/function.php on line 180

Warning: array_chunk() expects parameter 1 to be array, null given in /data/phpspider/zhask/libs/function.php on line 181

Warning: file_get_contents(/data/phpspider/zhask/data//catemap/7/python-2.7/5.json): failed to open stream: No such file or directory in /data/phpspider/zhask/libs/function.php on line 167

Warning: Invalid argument supplied for foreach() in /data/phpspider/zhask/libs/tag.function.php on line 1116

Notice: Undefined index: in /data/phpspider/zhask/libs/function.php on line 180

Warning: array_chunk() expects parameter 1 to be array, null given in /data/phpspider/zhask/libs/function.php on line 181
Android 列表视图和滚动_Android - Fatal编程技术网

Android 列表视图和滚动

Android 列表视图和滚动,android,Android,我需要显示一个滚动到特定项目的列表 我怎么做 Ori如果您正在使用ListView小部件,则可以调用ListView。您可以使用 listView.smoothScrollToPosition(specificPosition); --> 搜索“程序滚动”的其他问题,在这里和谷歌上都有大量类似的问题。我更喜欢这种解决方案,因为“smoothScroll”只有Android 2.2及以上版本,如果列表很大,可能需要很长时间。 <LinearLayout an

我需要显示一个滚动到特定项目的列表

我怎么做


Ori

如果您正在使用ListView小部件,则可以调用ListView。

您可以使用

listView.smoothScrollToPosition(specificPosition);


-->


搜索“程序滚动”的其他问题,在这里和谷歌上都有大量类似的问题。我更喜欢这种解决方案,因为“smoothScroll”只有Android 2.2及以上版本,如果列表很大,可能需要很长时间。
    <LinearLayout
        android:orientation="vertical"
        android:layout_width="fill_parent"
        android:layout_height="wrap_content">

        <LinearLayout
            android:orientation="vertical"
            android:layout_width="fill_parent"
            android:layout_height="wrap_content"
            style="?whiteBackground">



        </LinearLayout>
        <TextView android:id="@+id/textView1" android:layout_width="fill_parent" style="?textTitle" android:layout_height="wrap_content" android:text="Contents"></TextView>

        <TextView
            android:layout_width="fill_parent"
            android:layout_height="wrap_content"
            android:text="the following is content..."
            style="?textSubheader"/>

        <!-- You cannot have a ListView inside of a ScrollView. This LinearLayout acts like one. -->
        <LinearLayout
            android:orientation="vertical"
            android:layout_width="fill_parent"
            android:layout_height="wrap_content"
            >
            <ListView android:id="@+id/lv" android:textColor="#444444"
                android:layout_height="270dip" 
                 android:textStyle="bold"


                android:cacheColorHint="#00000000" android:dividerHeight="2px"
                android:layout_marginTop="5px" android:layout_width="fill_parent"
                android:textSize="5px" android:layout_gravity="center">
            </ListView>
<TextView android:id="@+id/any_old_widgetqss" 
    android:layout_width="fill_parent" style="?textTitle"
    android:layout_height="40px" android:text="MCMS" android:background="@drawable/colorr"></TextView>

        </LinearLayout>

    </LinearLayout>

</ScrollView>