首页
学习
活动
专区
圈层
工具
发布
社区首页 >问答首页 >ListView和Scroll

ListView和Scroll
EN

Stack Overflow用户
提问于 2010-04-13 18:23:25
回答 3查看 1.8K关注 0票数 3

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

我该怎么做呢?

Ori

EN

回答 3

Stack Overflow用户

回答已采纳

发布于 2011-04-12 03:43:21

您可以使用

代码语言:javascript
复制
listView.smoothScrollToPosition(specificPosition);
票数 8
EN

Stack Overflow用户

发布于 2010-10-18 01:08:41

假设您正在使用listview小部件,那么您就可以调用列表视图的setSelection(position)了。

票数 7
EN

Stack Overflow用户

发布于 2011-05-04 17:20:13

代码语言:javascript
复制
    <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"
            >
代码语言:javascript
复制
    -->  
代码语言:javascript
复制
            <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>
票数 -1
EN
页面原文内容由Stack Overflow提供。腾讯云小微IT领域专用引擎提供翻译支持
原文链接:

https://stackoverflow.com/questions/2628741

复制
相关文章

相似问题

领券
问题归档专栏文章快讯文章归档关键词归档开发者手册归档开发者手册 Section 归档