0

我已经设计了我的布局,在较小的手机屏幕上并不是所有的东西都是可见的,所以我想让它可以滚动,有人可以帮我解决这个问题吗?下面是我的布局的基本结构。

<?xml version="1.0" encoding="utf-8"?>
<LinearLayout
    xmlns:android="http://schemas.android.com/apk/res/android"
    android:orientation="vertical"
    android:layout_width="match_parent"
    android:layout_height="match_parent"
    android:id="@+id/allowanceroot"
    android:background="@drawable/background"
    >
    --TextView--
    --EditText--
    --TextView--
    --EditText--
    --TextView--
    --EditText--
</LinearLayout>

我是否只将我的 TextViews 和 EditTexts 包含在 LinearLayout 中,然后将其包含在 ScrollView 中?还有什么我需要以编程方式做的吗?

4

2 回答 2

2

尝试将其包装在滚动视图中

https://stackoverflow.com/a/4202608/661079

您无需做任何其他事情

于 2012-01-09T17:41:18.807 回答
1

像这样试试

  <?xml version="1.0" encoding="utf-8"?>

    <ScrollView xmlns:android="http://schemas.android.com/apk/res/android"
        android:id="@+id/scroller"
        android:layout_width="fill_parent"
        android:layout_height="fill_parent"
        >
        <LinearLayout
            android:layout_width="fill_parent"
            android:layout_height="wrap_content"
            android:orientation="vertical">
            <TextView />
            <TextView />

        </LinearLayout>
    </ScrollView>
于 2012-01-09T17:46:34.450 回答