开发者

how to bring a button to the focus in android?

开发者 https://www.devze.com 2023-03-14 19:53 出处:网络
I have ScrollViewwhich contains 10 buttons. When a activity is launched only first four buttons is visible on the screen. How can i bring the last button to focus when activity is launched.?

I have ScrollView which contains 10 buttons. When a activity is launched only first four buttons is visible on the screen. How can i bring the last button to focus when activity is launched.?

<HorizontalScrollView xmlns:android="http://schemas.android.com/apk/res/android"
            android:layout_width="wrap_content" android:layout_height="match_parent"
            android:scrollbars="none">
            <LinearLayout android:id="@+id/header"
                android:layout_width="60dp" android:layout_height="match_parent"
                android:orientation="horizontal">
                <Button android:text="Claim" android:id="@+id/claim"
                    android:layout_width="wrap_content" android:layout_height="45dp"
                    android:onClick="headerClick" android:background="@drawable/buttonselector"
                    android:layout_margin="2dp" android:padding="2dp"
                    android:textColor="#ffffff"></Button> . (etc). .<Button android:text="Signature" android:id="@+id/signature"
                    android:layout_width="wrap_content" android:layout_height="45dp"
                    android:onClick="headerClick" android:layout_margin="2dp"
                    android:textColor="#ffffff" androi开发者_StackOverflow中文版d:background="@drawable/buttonselector"
                    android:padding="10dp"></Button>
            </LinearLayout>
        </HorizontalScrollView>


you can do it like this:

scrollView.scrollTo(mScrollView.getWidth(), 0);    
0

精彩评论

暂无评论...
验证码 换一张
取 消