Android 使视图可滚动,因为隐藏的文本

Android 使视图可滚动,因为隐藏的文本,android,android-layout,scrollable,Android,Android Layout,Scrollable,我有一个活动,屏幕上有两个垂直的线性布局,右下角有1-2个按钮 根据线性布局的长度,布局中的文本可能对按钮隐藏。因此,我想让活动始终可滚动,以便用户能够将LinearLayouts向上拖动一点并读取文本 这里是一个小的可视化: 我在网上找到了一些解决方案,尝试了一下,但不起作用: 第一次尝试: <ConstraintLayout> <LinearLayout>...</LinearLayout> <LinearLayout>...

我有一个活动,屏幕上有两个垂直的线性布局,右下角有1-2个按钮

根据线性布局的长度,布局中的文本可能对按钮隐藏。因此,我想让活动始终可滚动,以便用户能够将LinearLayouts向上拖动一点并读取文本

这里是一个小的可视化:

我在网上找到了一些解决方案,尝试了一下,但不起作用:

第一次尝试:

<ConstraintLayout>
    <LinearLayout>...</LinearLayout>
    <LinearLayout>...</LinearLayout>
    <Button>...</Button>
<ConstraintLayout>

...
...
...
第二次尝试:

<RelativeLayout  xmlns:android="http://schemas.android.com/apk/res/android"
    xmlns:app="http://schemas.android.com/apk/res-auto"
    xmlns:tools="http://schemas.android.com/tools"
    android:layout_width="match_parent"
    android:layout_height="match_parent">
    <ScrollView
        android:layout_width="match_parent"
        android:layout_height="match_parent">
        <LinearLayout
            android:layout_width="match_parent"
            android:layout_height="wrap_content"
            android:orientation="vertical">
                <LinearLayout>...</LinearLayout>
                <LinearLayout>...</LinearLayout>
        </LinearLayout>
    </ScrollView>
    <RelativeLayout
         android:layout_width="match_parent"
         android:layout_height="wrap_content"
         android:layout_alignParentBottom="true">
           <Button .... />
    </RelativeLayout>
</RelativeLayout>

...
...

尝试添加底部填充

<LinearLayout
            android:padding_bottom="50dp"
            />


ScrollView的属性是什么?添加属性这是一个非常简单的想法。它也起作用了。谢谢!