Warning: file_get_contents(/data/phpspider/zhask/data//catemap/5/actionscript-3/6.json): failed to open stream: No such file or directory in /data/phpspider/zhask/libs/function.php on line 167

Warning: Invalid argument supplied for foreach() in /data/phpspider/zhask/libs/tag.function.php on line 1116

Notice: Undefined index: in /data/phpspider/zhask/libs/function.php on line 180

Warning: array_chunk() expects parameter 1 to be array, null given in /data/phpspider/zhask/libs/function.php on line 181
Android 在操作发生后将焦点设置在scrollview顶部_Android_Scrollview - Fatal编程技术网

Android 在操作发生后将焦点设置在scrollview顶部

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" &

在我的应用程序中,我正在进行一些计算。整个布局在滚动视图中

结果显示在顶部。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"
    >


<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中