1

同じページのIDで要素にスクロールする例をグーグルで調べましたが、成功しませんでした。次の例でどうなるのだろうかと思っていました。

<?xml version="1.0" encoding="utf-8"?>
<ScrollView xmlns:android="http://schemas.android.com/apk/res/android"
    android:layout_width="fill_parent"
    android:layout_height="fill_parent"
    android:orientation="vertical" >

    <LinearLayout
       android:layout_width="fill_parent"
       android:layout_height="fill_parent" >

    <Button 
       android:id="@+id/pressMe"
       android:layout_height="wrap_content"
       android:layout_width="wrap_content"
       android:text="Press me to scroll to A">

    <ImageView
       android:id="@+id/scrollToMe"
       android:layout_height="100dp"
       android:layout_width="fill_parent"
       android:layout_marginTop="2000dp"
       android:background="#f00">

    </LinearLayout>

</ScrollView>
4

1 に答える 1

1

あなたはそのビューに集中することができます、そして、私は、それがそれに自動スクロールするだろうと思います。

必要なビューの座標を取得して、それらにスクロールすることもできると思います。

于 2012-06-18T11:43:48.843 に答える