Android 在操作发生后将焦点设置在scrollview顶部
在我的应用程序中,我正在进行一些计算。整个布局在滚动视图中 结果显示在顶部。Xml是这样的:Android 在操作发生后将焦点设置在scrollview顶部,android,scrollview,Android,Scrollview,在我的应用程序中,我正在进行一些计算。整个布局在滚动视图中 结果显示在顶部。Xml是这样的: <ScrollView xmlns:android="http://schemas.android.com/apk/res/android" android:layout_width="fill_parent" android:layout_height="fill_parent" android:background="@drawable/back2back" &
<ScrollView xmlns:android="http://schemas.android.com/apk/res/android"
android:layout_width="fill_parent"
android:layout_height="fill_parent"
android:background="@drawable/back2back"
>
<LinearLayout xmlns:android="http://schemas.android.com/apk/res/android"
android:layout_width="fill_parent"
android:layout_height="526dp"
android:background="@drawable/back4"
android:orientation="vertical" >
<TextView
android:id="@+id/nothing"
android:layout_width="181dp"
android:layout_height="51dp"
android:layout_gravity="center"
android:textColor="#000000"
android:textStyle="bold" />
rest of the xml
</LinearLayout>
</ScrollView>
xml的其余部分
因此,我想在按下计算按钮时,将屏幕的焦点设置在我的页面顶部(或者更具体地说,在上面的文本视图中),以便用户能够看到结果。我搜索了这么多,但没有找到类似的东西 如果我理解你的问题,只需打电话:
scrollView.scrollTo(0, 0);
在计算按钮的OnClickListener中