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>