Android LinearLayout 内的 ScrollView

Android ScrollView inside LinearLayout

我在 Andoid 中遇到布局(按钮)问题。我想要的是在 ScrollView 内显示按钮,但 ScrollView 必须在 RelativeLayout 下方,或者换句话说,ScrollView 的前两个按钮没有显示在我的 phone..

图片如下:

这是我的布局:

    <RelativeLayout  android:layout_width="fill_parent" android:layout_height="wrap_content">
        <TextView android:textAppearance="?android:textAppearanceLarge" android:id="@+id/textView1" android:layout_width="wrap_content" android:layout_height="wrap_content" android:layout_marginTop="58.0dip" android:text="@string/naziv" android:layout_alignParentTop="true" android:layout_centerHorizontal="true" />
    </RelativeLayout>

    <ScrollView
        android:layout_width="fill_parent"
        android:layout_height="fill_parent"
        android:id="@+id/scrollView" >

        <LinearLayout android:layout_gravity="center" android:orientation="vertical" android:paddingLeft="30.0dip" android:paddingTop="90.0dip" android:paddingRight="30.0dip"  android:paddingBottom="20dp" android:layout_width="fill_parent" android:layout_height="wrap_content">
            <Button android:id="@+id/button0"  android:layout_width="fill_parent" android:layout_height="wrap_content" android:text="@string/gumb_veter"  />
            <Button android:id="@+id/button4"  android:layout_width="fill_parent" android:layout_height="wrap_content" android:text="@string/gumb_plimovanje" />
            <Button android:id="@+id/button1"  android:layout_width="fill_parent" android:layout_height="wrap_content" android:text="@string/gumb_trenutni_podatki" />
            <Button android:id="@+id/button5"  android:layout_width="fill_parent" android:layout_height="wrap_content" android:text="@string/gumb_video" />
            <Button android:id="@+id/button2"  android:layout_width="fill_parent" android:layout_height="wrap_content" android:text="@string/gumb_mbp" />
            <Button android:id="@+id/button10"  android:layout_width="fill_parent" android:layout_height="wrap_content" android:text="@string/gumb_wsg"/>
            <Button android:id="@+id/button11"  android:layout_width="fill_parent" android:layout_height="wrap_content" android:text="@string/gumb_ath" />
            <Button android:id="@+id/button12"  android:layout_width="fill_parent" android:layout_height="wrap_content" android:text="@string/gumb_sts" />
            <Button android:id="@+id/button13"  android:layout_width="fill_parent" android:layout_height="wrap_content" android:text="@string/gumb_w" />
            <Button android:id="@+id/button14"  android:layout_width="fill_parent" android:layout_height="wrap_content" android:text="@string/gumb_dotb" />
            <Button android:id="@+id/button15"  android:layout_width="fill_parent" android:layout_height="wrap_content" android:text="@string/gumb_ast" />
            <Button android:id="@+id/button16"  android:layout_width="fill_parent" android:layout_height="wrap_content" android:text="@string/gumb_caw" />
            <Button android:id="@+id/button17"  android:layout_width="fill_parent" android:layout_height="wrap_content" android:text="@string/gumb_pado" />


        </LinearLayout>
    </ScrollView>



</LinearLayout>

如何在文本下方显示 ScrollView "morska bioloska postaja..."?

谢谢

您需要从 ScrollView 中的 LinearLayout 中删除 android:layout_gravity="center"。您可能还想删除它的 android:paddingTop="90.0dip".

将此添加到您的滚动视图:

android:layout_below = "@id/textView1"

这应该在您的 textView 下方添加滚动条,然后删除它:

android:layout_height="fill_parent"

并替换为:

android:layout_height="wrap_content"