1

私の Android アプリには、最初は表示されないビュー (ボタン、EditText など) がいくつかあります。これらは、特定のボタン クリック イベントでのみ表示されます。これらがユーザーに見えるように、スクロールビューをこれらのビューの最後に移動したいと思います。

レイアウト ファイルの関連部分:

    <ScrollView...>

    <RelativeLayout android:id="@+id/RelDevDet"
            android:layout_width="fill_parent" android:layout_height="wrap_content">
            .
            .
            .
            <ImageButton android:id="@+id/ibRateApp"
                android:layout_toRightOf="@id/tvRateApp"
                android:layout_alignTop="@id/tvRateApp"
                android:layout_width="wrap_content" android:layout_height="wrap_content"
                android:background="@drawable/arrow_up" android:clickable="true"
                android:layout_marginRight="5dp"
                android:paddingBottom="10dp"
                 />
            <RatingBar android:id="@+id/rtApp" android:layout_width="wrap_content" android:layout_height="wrap_content" android:layout_below="@+id/tvRateApp"
                android:layout_marginLeft="5dp" android:visibility="gone"/>
            <EditText android:layout_width="fill_parent"
                android:id="@+id/etRateApp"
                android:layout_height="wrap_content" 
                android:lines="3"
                android:layout_below="@+id/rtApp"
                android:layout_marginRight="5dp"
                android:layout_alignLeft="@+id/tvDevWeb"
                android:visibility="gone" />
            <Button android:id="@+id/btSubRat" android:layout_width="fill_parent" android:layout_height="wrap_content"
                android:layout_below="@+id/etRateApp" android:layout_margin="5dp" android:text="Submit" android:visibility="gone"/>
        </RelativeLayout>
        </ScrollView>

ボタンの onclicklistener は次のとおりです。

public void onClick(View v) {
if(v.getId()== R.id.ibRateApp){
            Log.d("amit","scroll end");
            rtApp.setVisibility(View.VISIBLE);
            etRateApp.setVisibility(View.VISIBLE);
            //How to get the scrollview move to the end of the page here??
        }
}
4

4 に答える 4

8
scroll.fullScroll(View.FOCUS_DOWN);

これで修正されました。

于 2012-12-06T05:07:19.243 に答える
0

使用する

 mScrollViewLayout.scrollTo(0, mScrollViewLayout.getMaxScrollAmount ());
于 2012-12-04T08:30:00.113 に答える