LinearLayout 不随 ScrollView 滚动

won*_*ggr 5 android android-layout

我有一个 LinearLayout,其中有很多以编程方式放入的 TextView。我所说的“很多”是指它超出了屏幕底部。我想使用 ScrollView 来允许用户滚动到屏幕之外并查看 TextView 的其余部分。这是我当前的activity_main.xml:

<?xml version="1.0" encoding="utf-8"?>
<ScrollView xmlns:android="http://schemas.android.com/apk/res/android"
android:layout_width="match_parent"
android:layout_height="wrap_content" >

<LinearLayout
    android:id="@+id/ll"
    android:layout_width="wrap_content"
    android:layout_height="wrap_content"
    android:layout_marginBottom="61dp"
    android:orientation="vertical" >
</LinearLayout>

</ScrollView>
Run Code Online (Sandbox Code Playgroud)

任何帮助将不胜感激!谢谢!

Ahm*_*ani 1

尝试更改android:layout_width="wrap_content"android:layout_width="match_parent"

<LinearLayout
    android:id="@+id/ll"
    android:layout_width="match_parent"
    android:layout_height="match_parent"
    android:layout_marginBottom="61dp"
    android:orientation="vertical" >
</LinearLayout>

</ScrollView>
Run Code Online (Sandbox Code Playgroud)