如何在触摸android studio上向上向下移动活动

如何在触摸android studio上向上向下移动活动,android,Android,我在android studio中创建了一个应用程序,在点击按钮后填充edittext,我在textview中得到结果文本。因为内容视图的长度被剪切。我希望触摸式视图(活动)可以上下移动以查看视图中的所有内容。附上图片 使用滚动视图。当视图大于设备大小时,它将自动滚动 <ScrollView xmlns:android="http://schemas.android.com/apk/res/android" android:layout_width="match_parent" andro

我在android studio中创建了一个应用程序,在点击按钮后填充edittext,我在textview中得到结果文本。因为内容视图的长度被剪切。我希望触摸式视图(活动)可以上下移动以查看视图中的所有内容。附上图片


使用滚动视图。当视图大于设备大小时,它将自动滚动

<ScrollView xmlns:android="http://schemas.android.com/apk/res/android"
android:layout_width="match_parent"
android:layout_height="match_parent"
android:fillViewport="true">

<LinearLayout
    android:layout_width="match_parent"
    android:layout_height="match_parent" >
    <!-- your  xml code-->
</LinearLayout>
</ScrollView>

父布局
用作
滚动视图
,但滚动视图仅超过一个子布局

<ScrollView 
    xmlns:android="http://schemas.android.com/apk/res/android"
    android:layout_width="match_parent"
    android:layout_height="match_parent"
    >
   <RelativeLayout
        android:layout_width="match_parent"
        android:layout_height="match_parent" >

    </RelativeLayout>
</ScrollView>


请检查此项以供参考。

将布局(xml数据)放入滚动视图谢谢您的即时回复我使用代码,工作正常,但我可以将滚动移动限制为内容,因为滚动视图上的空白空间较大,看起来很难看。请从视图中删除空白和边距空间。