Android 只有部分按钮显示在linearlayout上

Android 只有部分按钮显示在linearlayout上,android,xml,android-layout,layout,Android,Xml,Android Layout,Layout,我有一个线性布局,每行有3个按钮,在水平和垂直方向上填充屏幕,但最底部的按钮并不是整体显示的。这是代码 <?xml version="1.0" encoding="utf-8"?> <LinearLayout xmlns:android="http://schemas.android.com/apk/res/android" android:layout_width="match_parent" android:layout_height="match_parent" andr

我有一个线性布局,每行有3个按钮,在水平和垂直方向上填充屏幕,但最底部的按钮并不是整体显示的。这是代码

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

<ScrollView
    android:layout_width="match_parent"
    android:layout_height="0dp"
    android:layout_weight="1"
    android:fillViewport="true" >
    <LinearLayout
        android:layout_width="match_parent"
        android:layout_height="wrap_content"
        android:orientation="vertical"
        >
        <LinearLayout
        android:layout_width="match_parent"
        android:layout_height="wrap_content"
        android:orientation="horizontal"
        >

        <Button
            android:layout_width="match_parent"
            android:layout_height="75dp"
            android:layout_weight="1"
            android:textSize="15dp" />

        <Button
            android:layout_width="match_parent"
            android:layout_height="75dp"
            android:layout_weight="1"
            android:textSize="15dp" />

        <Button
            android:layout_width="match_parent"
            android:layout_height="75dp"
            android:layout_weight="1"
            android:textSize="15dp" />

    </LinearLayout>
        <LinearLayout
            android:layout_width="match_parent"
            android:layout_height="wrap_content"
            android:orientation="horizontal"
            >

            <Button
                android:layout_width="match_parent"
                android:layout_height="75dp"
                android:layout_weight="1"
                android:textSize="15dp" />

            <Button
                android:layout_width="match_parent"
                android:layout_height="75dp"
                android:layout_weight="1"
                android:textSize="15dp" />

            <Button
                android:layout_width="match_parent"
                android:layout_height="75dp"
                android:layout_weight="1"
                android:textSize="15dp" />

        </LinearLayout>
        <LinearLayout
            android:layout_width="match_parent"
            android:layout_height="wrap_content"
            android:orientation="horizontal"
            >

            <Button
                android:layout_width="match_parent"
                android:layout_height="75dp"
                android:layout_weight="1"
                android:textSize="15dp" />

            <Button
                android:layout_width="match_parent"
                android:layout_height="75dp"
                android:layout_weight="1"
                android:textSize="15dp" />

            <Button
                android:layout_width="match_parent"
                android:layout_height="75dp"
                android:layout_weight="1"
                android:textSize="15dp" />

        </LinearLayout>
        <LinearLayout
            android:layout_width="match_parent"
            android:layout_height="wrap_content"
            android:orientation="horizontal"
            >

            <Button
                android:layout_width="match_parent"
                android:layout_height="75dp"
                android:layout_weight="1"
                android:textSize="15dp" />

            <Button
                android:layout_width="match_parent"
                android:layout_height="75dp"
                android:layout_weight="1"
                android:textSize="15dp" />

            <Button
                android:layout_width="match_parent"
                android:layout_height="75dp"
                android:layout_weight="1"
                android:textSize="15dp" />

        </LinearLayout>
        <LinearLayout
            android:layout_width="match_parent"
            android:layout_height="wrap_content"
            android:orientation="horizontal"
            >

            <Button
                android:layout_width="match_parent"
                android:layout_height="75dp"
                android:layout_weight="1"
                android:textSize="15dp" />

            <Button
                android:layout_width="match_parent"
                android:layout_height="75dp"
                android:layout_weight="1"
                android:textSize="15dp" />

            <Button
                android:layout_width="match_parent"
                android:layout_height="75dp"
                android:layout_weight="1"
                android:textSize="15dp" />

        </LinearLayout>
        <LinearLayout
            android:layout_width="match_parent"
            android:layout_height="wrap_content"
            android:orientation="horizontal"
            >

            <Button
                android:layout_width="match_parent"
                android:layout_height="75dp"
                android:layout_weight="1"
                android:textSize="15dp" />

            <Button
                android:layout_width="match_parent"
                android:layout_height="75dp"
                android:layout_weight="1"
                android:textSize="15dp" />

            <Button
                android:layout_width="match_parent"
                android:layout_height="75dp"
                android:layout_weight="1"
                android:textSize="15dp" />

        </LinearLayout>
        <LinearLayout
            android:layout_width="match_parent"
            android:layout_height="wrap_content"
            android:orientation="horizontal"
            >

            <Button
                android:layout_width="match_parent"
                android:layout_height="75dp"
                android:layout_weight="1"
                android:textSize="15dp" />

            <Button
                android:layout_width="match_parent"
                android:layout_height="75dp"
                android:layout_weight="1"
                android:textSize="15dp" />

            <Button
                android:layout_width="match_parent"
                android:layout_height="75dp"
                android:layout_weight="1"
                android:textSize="15dp" />

        </LinearLayout>
        <LinearLayout
            android:layout_width="match_parent"
            android:layout_height="wrap_content"
            android:orientation="horizontal"
            >

            <Button
                android:layout_width="match_parent"
                android:layout_height="75dp"
                android:layout_weight="1"
                android:textSize="15dp" />

            <Button
                android:layout_width="match_parent"
                android:layout_height="75dp"
                android:layout_weight="1"
                android:textSize="15dp" />

            <Button
                android:layout_width="match_parent"
                android:layout_height="75dp"
                android:layout_weight="1"
                android:textSize="15dp" />

        </LinearLayout>
        <LinearLayout
            android:layout_width="match_parent"
            android:layout_height="wrap_content"
            android:orientation="horizontal"
            >

            <Button
                android:layout_width="match_parent"
                android:layout_height="75dp"
                android:layout_weight="1"
                android:textSize="15dp" />

            <Button
                android:layout_width="match_parent"
                android:layout_height="75dp"
                android:layout_weight="1"
                android:textSize="15dp" />

            <Button
                android:layout_width="match_parent"
                android:layout_height="75dp"
                android:layout_weight="1"
                android:textSize="15dp" />

        </LinearLayout>




    </LinearLayout>
</ScrollView>

</LinearLayout>

以及主要的xml

<?xml version="1.0" encoding="utf-8"?>
<android.support.design.widget.CoordinatorLayout
    xmlns:android="http://schemas.android.com/apk/res/android"
    xmlns:app="http://schemas.android.com/apk/res-auto"
    android:layout_width="match_parent"
    android:layout_height="match_parent">

    <android.support.design.widget.AppBarLayout
        android:layout_width="match_parent"
        android:layout_height="wrap_content"
        android:theme="@style/ThemeOverlay.AppCompat.Dark.ActionBar">

        <android.support.v7.widget.Toolbar
            android:id="@+id/toolbar"
            android:layout_width="match_parent"
            android:layout_height="?attr/actionBarSize"
            android:background="?attr/colorPrimary"
            app:layout_scrollFlags="scroll|enterAlways"
            app:popupTheme="@style/ThemeOverlay.AppCompat.Light" />

        <android.support.design.widget.TabLayout
            android:id="@+id/tabs"
            android:layout_width="match_parent"
            android:layout_height="wrap_content"
            app:tabMode="fixed"
            app:tabGravity="fill"/>
    </android.support.design.widget.AppBarLayout>

    <android.support.v4.view.ViewPager
        android:id="@+id/viewpager"
        android:layout_width="match_parent"
        android:layout_height="match_parent"
        app:layout_behavior="@string/appbar_scrolling_view_behavior"  />
</android.support.design.widget.CoordinatorLayout>


线性布局的最后一个结束标记丢失了。关闭标签

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

    <ScrollView
        android:layout_width="match_parent"
        android:layout_height="0dp"
        android:layout_weight="1"
        android:fillViewport="true">

        <LinearLayout
            android:layout_width="match_parent"
            android:layout_height="wrap_content"
            android:orientation="vertical">

            <LinearLayout
                android:layout_width="match_parent"
                android:layout_height="wrap_content"
                android:orientation="horizontal">

                <Button
                    android:layout_width="match_parent"
                    android:layout_height="75dp"
                    android:layout_weight="1"
                    android:textSize="15dp" />

                <Button
                    android:layout_width="match_parent"
                    android:layout_height="75dp"
                    android:layout_weight="1"
                    android:textSize="15dp" />

                <Button
                    android:layout_width="match_parent"
                    android:layout_height="75dp"
                    android:layout_weight="1"
                    android:textSize="15dp" />

            </LinearLayout>

            <LinearLayout
                android:layout_width="match_parent"
                android:layout_height="wrap_content"
                android:orientation="horizontal">

                <Button
                    android:layout_width="match_parent"
                    android:layout_height="75dp"
                    android:layout_weight="1"
                    android:textSize="15dp" />

                <Button
                    android:layout_width="match_parent"
                    android:layout_height="75dp"
                    android:layout_weight="1"
                    android:textSize="15dp" />

                <Button
                    android:layout_width="match_parent"
                    android:layout_height="75dp"
                    android:layout_weight="1"
                    android:textSize="15dp" />

            </LinearLayout>

            <LinearLayout
                android:layout_width="match_parent"
                android:layout_height="wrap_content"
                android:orientation="horizontal">

                <Button
                    android:layout_width="match_parent"
                    android:layout_height="75dp"
                    android:layout_weight="1"
                    android:textSize="15dp" />

                <Button
                    android:layout_width="match_parent"
                    android:layout_height="75dp"
                    android:layout_weight="1"
                    android:textSize="15dp" />

                <Button
                    android:layout_width="match_parent"
                    android:layout_height="75dp"
                    android:layout_weight="1"
                    android:textSize="15dp" />

            </LinearLayout>

            <LinearLayout
                android:layout_width="match_parent"
                android:layout_height="wrap_content"
                android:orientation="horizontal">

                <Button
                    android:layout_width="match_parent"
                    android:layout_height="75dp"
                    android:layout_weight="1"
                    android:textSize="15dp" />

                <Button
                    android:layout_width="match_parent"
                    android:layout_height="75dp"
                    android:layout_weight="1"
                    android:textSize="15dp" />

                <Button
                    android:layout_width="match_parent"
                    android:layout_height="75dp"
                    android:layout_weight="1"
                    android:textSize="15dp" />

            </LinearLayout>

            <LinearLayout
                android:layout_width="match_parent"
                android:layout_height="wrap_content"
                android:orientation="horizontal">

                <Button
                    android:layout_width="match_parent"
                    android:layout_height="75dp"
                    android:layout_weight="1"
                    android:textSize="15dp" />

                <Button
                    android:layout_width="match_parent"
                    android:layout_height="75dp"
                    android:layout_weight="1"
                    android:textSize="15dp" />

                <Button
                    android:layout_width="match_parent"
                    android:layout_height="75dp"
                    android:layout_weight="1"
                    android:textSize="15dp" />

            </LinearLayout>

            <LinearLayout
                android:layout_width="match_parent"
                android:layout_height="wrap_content"
                android:orientation="horizontal">

                <Button
                    android:layout_width="match_parent"
                    android:layout_height="75dp"
                    android:layout_weight="1"
                    android:textSize="15dp" />

                <Button
                    android:layout_width="match_parent"
                    android:layout_height="75dp"
                    android:layout_weight="1"
                    android:textSize="15dp" />

                <Button
                    android:layout_width="match_parent"
                    android:layout_height="75dp"
                    android:layout_weight="1"
                    android:textSize="15dp" />

            </LinearLayout>

            <LinearLayout
                android:layout_width="match_parent"
                android:layout_height="wrap_content"
                android:orientation="horizontal">

                <Button
                    android:layout_width="match_parent"
                    android:layout_height="75dp"
                    android:layout_weight="1"
                    android:textSize="15dp" />

                <Button
                    android:layout_width="match_parent"
                    android:layout_height="75dp"
                    android:layout_weight="1"
                    android:textSize="15dp" />

                <Button
                    android:layout_width="match_parent"
                    android:layout_height="75dp"
                    android:layout_weight="1"
                    android:textSize="15dp" />

            </LinearLayout>

            <LinearLayout
                android:layout_width="match_parent"
                android:layout_height="wrap_content"
                android:orientation="horizontal">

                <Button
                    android:layout_width="match_parent"
                    android:layout_height="75dp"
                    android:layout_weight="1"
                    android:textSize="15dp" />

                <Button
                    android:layout_width="match_parent"
                    android:layout_height="75dp"
                    android:layout_weight="1"
                    android:textSize="15dp" />

                <Button
                    android:layout_width="match_parent"
                    android:layout_height="75dp"
                    android:layout_weight="1"
                    android:textSize="15dp" />

            </LinearLayout>

            <LinearLayout
                android:layout_width="match_parent"
                android:layout_height="wrap_content"
                android:orientation="horizontal">

                <Button
                    android:layout_width="match_parent"
                    android:layout_height="75dp"
                    android:layout_weight="1"
                    android:textSize="15dp" />

                <Button
                    android:layout_width="match_parent"
                    android:layout_height="75dp"
                    android:layout_weight="1"
                    android:textSize="15dp" />

                <Button
                    android:layout_width="match_parent"
                    android:layout_height="75dp"
                    android:layout_weight="1"
                    android:textSize="15dp" />

            </LinearLayout>


        </LinearLayout>
    </ScrollView>
</LinearLayout>

试试这个代码,它一定能用

 <?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="match_parent"
android:layout_weight="1"
android:fillViewport="true" ><LinearLayout

android:layout_width="match_parent"
android:layout_height="match_parent"
android:orientation="vertical">

    <LinearLayout
        android:layout_width="match_parent"
        android:layout_height="wrap_content"
        android:orientation="vertical"
        >
        <LinearLayout
            android:layout_width="match_parent"
            android:layout_height="wrap_content"
            android:orientation="horizontal"
            >

            <Button
                android:layout_width="match_parent"
                android:layout_height="75dp"
                android:layout_weight="1"
                android:textSize="15dp" />

            <Button
                android:layout_width="match_parent"
                android:layout_height="75dp"
                android:layout_weight="1"
                android:textSize="15dp" />

            <Button
                android:layout_width="match_parent"
                android:layout_height="75dp"
                android:layout_weight="1"
                android:textSize="15dp" />

        </LinearLayout>
        <LinearLayout
            android:layout_width="match_parent"
            android:layout_height="wrap_content"
            android:orientation="horizontal"
            >

            <Button
                android:layout_width="match_parent"
                android:layout_height="75dp"
                android:layout_weight="1"
                android:textSize="15dp" />

            <Button
                android:layout_width="match_parent"
                android:layout_height="75dp"
                android:layout_weight="1"
                android:textSize="15dp" />

            <Button
                android:layout_width="match_parent"
                android:layout_height="75dp"
                android:layout_weight="1"
                android:textSize="15dp" />

        </LinearLayout>
        <LinearLayout
            android:layout_width="match_parent"
            android:layout_height="wrap_content"
            android:orientation="horizontal"
            >

            <Button
                android:layout_width="match_parent"
                android:layout_height="75dp"
                android:layout_weight="1"
                android:textSize="15dp" />

            <Button
                android:layout_width="match_parent"
                android:layout_height="75dp"
                android:layout_weight="1"
                android:textSize="15dp" />

            <Button
                android:layout_width="match_parent"
                android:layout_height="75dp"
                android:layout_weight="1"
                android:textSize="15dp" />

        </LinearLayout>
        <LinearLayout
            android:layout_width="match_parent"
            android:layout_height="wrap_content"
            android:orientation="horizontal"
            >

            <Button
                android:layout_width="match_parent"
                android:layout_height="75dp"
                android:layout_weight="1"
                android:textSize="15dp" />

            <Button
                android:layout_width="match_parent"
                android:layout_height="75dp"
                android:layout_weight="1"
                android:textSize="15dp" />

            <Button
                android:layout_width="match_parent"
                android:layout_height="75dp"
                android:layout_weight="1"
                android:textSize="15dp" />

        </LinearLayout>
        <LinearLayout
            android:layout_width="match_parent"
            android:layout_height="wrap_content"
            android:orientation="horizontal"
            >

            <Button
                android:layout_width="match_parent"
                android:layout_height="75dp"
                android:layout_weight="1"
                android:textSize="15dp" />

            <Button
                android:layout_width="match_parent"
                android:layout_height="75dp"
                android:layout_weight="1"
                android:textSize="15dp" />

            <Button
                android:layout_width="match_parent"
                android:layout_height="75dp"
                android:layout_weight="1"
                android:textSize="15dp" />

        </LinearLayout>
        <LinearLayout
            android:layout_width="match_parent"
            android:layout_height="wrap_content"
            android:orientation="horizontal"
            >

            <Button
                android:layout_width="match_parent"
                android:layout_height="75dp"
                android:layout_weight="1"
                android:textSize="15dp" />

            <Button
                android:layout_width="match_parent"
                android:layout_height="75dp"
                android:layout_weight="1"
                android:textSize="15dp" />

            <Button
                android:layout_width="match_parent"
                android:layout_height="75dp"
                android:layout_weight="1"
                android:textSize="15dp" />

        </LinearLayout>
        <LinearLayout
            android:layout_width="match_parent"
            android:layout_height="wrap_content"
            android:orientation="horizontal"
            >

            <Button
                android:layout_width="match_parent"
                android:layout_height="75dp"
                android:layout_weight="1"
                android:textSize="15dp" />

            <Button
                android:layout_width="match_parent"
                android:layout_height="75dp"
                android:layout_weight="1"
                android:textSize="15dp" />

            <Button
                android:layout_width="match_parent"
                android:layout_height="75dp"
                android:layout_weight="1"
                android:textSize="15dp" />

        </LinearLayout>
        <LinearLayout
            android:layout_width="match_parent"
            android:layout_height="wrap_content"
            android:orientation="horizontal"
            >

            <Button
                android:layout_width="match_parent"
                android:layout_height="75dp"
                android:layout_weight="1"
                android:textSize="15dp" />

            <Button
                android:layout_width="match_parent"
                android:layout_height="75dp"
                android:layout_weight="1"
                android:textSize="15dp" />

            <Button
                android:layout_width="match_parent"
                android:layout_height="75dp"
                android:layout_weight="1"
                android:textSize="15dp" />

        </LinearLayout>
        <LinearLayout
            android:layout_width="match_parent"
            android:layout_height="wrap_content"
            android:orientation="horizontal"
            >

            <Button
                android:layout_width="match_parent"
                android:layout_height="75dp"
                android:layout_weight="1"
                android:textSize="15dp" />

            <Button
                android:layout_width="match_parent"
                android:layout_height="75dp"
                android:layout_weight="1"
                android:textSize="15dp" />

            <Button
                android:layout_width="match_parent"
                android:layout_height="75dp"
                android:layout_weight="1"
                android:textSize="15dp" />

        </LinearLayout>




    </LinearLayout>

ScrollView
不与容器协调。 使用
CoordinateLayout
时,建议使用
android.support.v4.widget.NestedScrollView
用于滚动子对象 观点

使用
android.support.v4.widget.NestedScrollView
而不是
ScrollView

以下是工作代码:

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

    <android.support.v4.widget.NestedScrollView
        android:layout_width="match_parent"
        android:layout_height="wrap_content"
        android:fillViewport="true" >

        <LinearLayout
            android:layout_width="match_parent"
            android:layout_height="wrap_content"
            android:orientation="vertical">

            <LinearLayout
                android:layout_width="match_parent"
                android:layout_height="wrap_content"
                android:orientation="horizontal">

                <Button
                    android:layout_width="match_parent"
                    android:layout_height="75dp"
                    android:layout_weight="1"
                    android:textSize="15dp"
                    android:text="1"/>

                <Button
                    android:layout_width="match_parent"
                    android:layout_height="75dp"
                    android:layout_weight="1"
                    android:textSize="15dp"
                    android:text="2"/>

                <Button
                    android:layout_width="match_parent"
                    android:layout_height="75dp"
                    android:layout_weight="1"
                    android:textSize="15dp"
                    android:text="3"/>

            </LinearLayout>
            <LinearLayout
                android:layout_width="match_parent"
                android:layout_height="wrap_content"
                android:orientation="horizontal">

                <Button
                    android:layout_width="match_parent"
                    android:layout_height="75dp"
                    android:layout_weight="1"
                    android:textSize="15dp"
                    android:text="4"/>

                <Button
                    android:layout_width="match_parent"
                    android:layout_height="75dp"
                    android:layout_weight="1"
                    android:textSize="15dp"
                    android:text="5"/>

                <Button
                    android:layout_width="match_parent"
                    android:layout_height="75dp"
                    android:layout_weight="1"
                    android:textSize="15dp"
                    android:text="6"/>

            </LinearLayout>
            <LinearLayout
                android:layout_width="match_parent"
                android:layout_height="wrap_content"
                android:orientation="horizontal">

                <Button
                    android:layout_width="match_parent"
                    android:layout_height="75dp"
                    android:layout_weight="1"
                    android:textSize="15dp"
                    android:text="7"/>

                <Button
                    android:layout_width="match_parent"
                    android:layout_height="75dp"
                    android:layout_weight="1"
                    android:textSize="15dp"
                    android:text="8"/>

                <Button
                    android:layout_width="match_parent"
                    android:layout_height="75dp"
                    android:layout_weight="1"
                    android:textSize="15dp"
                    android:text="9"/>

            </LinearLayout>
            <LinearLayout
                android:layout_width="match_parent"
                android:layout_height="wrap_content"
                android:orientation="horizontal">

                <Button
                    android:layout_width="match_parent"
                    android:layout_height="75dp"
                    android:layout_weight="1"
                    android:textSize="15dp"
                    android:text="10"/>

                <Button
                    android:layout_width="match_parent"
                    android:layout_height="75dp"
                    android:layout_weight="1"
                    android:textSize="15dp"
                    android:text="11"/>

                <Button
                    android:layout_width="match_parent"
                    android:layout_height="75dp"
                    android:layout_weight="1"
                    android:textSize="15dp"
                    android:text="12"/>

            </LinearLayout>

            <LinearLayout
                android:layout_width="match_parent"
                android:layout_height="wrap_content"
                android:orientation="horizontal">

                <Button
                    android:layout_width="match_parent"
                    android:layout_height="75dp"
                    android:layout_weight="1"
                    android:textSize="15dp"
                    android:text="13"/>

                <Button
                    android:layout_width="match_parent"
                    android:layout_height="75dp"
                    android:layout_weight="1"
                    android:textSize="15dp"
                    android:text="14"/>

                <Button
                    android:layout_width="match_parent"
                    android:layout_height="75dp"
                    android:layout_weight="1"
                    android:textSize="15dp"
                    android:text="15"/>

            </LinearLayout>

            <LinearLayout
                android:layout_width="match_parent"
                android:layout_height="wrap_content"
                android:orientation="horizontal">

                <Button
                    android:layout_width="match_parent"
                    android:layout_height="75dp"
                    android:layout_weight="1"
                    android:textSize="15dp"
                    android:text="16"/>

                <Button
                    android:layout_width="match_parent"
                    android:layout_height="75dp"
                    android:layout_weight="1"
                    android:textSize="15dp"
                    android:text="17"/>

                <Button
                    android:layout_width="match_parent"
                    android:layout_height="75dp"
                    android:layout_weight="1"
                    android:textSize="15dp"
                    android:text="18"/>

            </LinearLayout>

            <LinearLayout
                android:layout_width="match_parent"
                android:layout_height="wrap_content"
                android:orientation="horizontal">

                <Button
                    android:layout_width="match_parent"
                    android:layout_height="75dp"
                    android:layout_weight="1"
                    android:textSize="15dp"
                    android:text="19"/>

                <Button
                    android:layout_width="match_parent"
                    android:layout_height="75dp"
                    android:layout_weight="1"
                    android:textSize="15dp"
                    android:text="20"/>

                <Button
                    android:layout_width="match_parent"
                    android:layout_height="75dp"
                    android:layout_weight="1"
                    android:textSize="15dp"
                    android:text="21"/>

            </LinearLayout>

            <LinearLayout
                android:layout_width="match_parent"
                android:layout_height="wrap_content"
                android:orientation="horizontal">

                <Button
                    android:layout_width="match_parent"
                    android:layout_height="75dp"
                    android:layout_weight="1"
                    android:textSize="15dp"
                    android:text="22"/>

                <Button
                    android:layout_width="match_parent"
                    android:layout_height="75dp"
                    android:layout_weight="1"
                    android:textSize="15dp"
                    android:text="23"/>

                <Button
                    android:layout_width="match_parent"
                    android:layout_height="75dp"
                    android:layout_weight="1"
                    android:textSize="15dp"
                    android:text="24"/>

            </LinearLayout>

            <LinearLayout
                android:layout_width="match_parent"
                android:layout_height="wrap_content"
                android:orientation="horizontal">

                <Button
                    android:layout_width="match_parent"
                    android:layout_height="75dp"
                    android:layout_weight="1"
                    android:textSize="15dp"
                    android:text="25"/>

                <Button
                    android:layout_width="match_parent"
                    android:layout_height="75dp"
                    android:layout_weight="1"
                    android:textSize="15dp"
                    android:text="26"/>

                <Button
                    android:layout_width="match_parent"
                    android:layout_height="75dp"
                    android:layout_weight="1"
                    android:textSize="15dp"
                    android:text="27"/>

            </LinearLayout>
        </LinearLayout>
    </android.support.v4.widget.NestedScrollView>
</LinearLayout>


main LinearLayout closing tag(主线性布局结束标记)最后留在代码中您在预览中看到了吗?我看到您忘记在
LinearLayout
中指定
weightSum
。将其定义为
3
抱歉,我忘记缩进最后一个结束标记,因此我的实际代码有结束标记,并且仍然存在问题抱歉,我没有看到我忘记复制代码的最后一部分,但这是我的实际代码,因此标记已关闭。“我仍然有问题。”gunessun底部的按钮正在显示给我。问题是什么?只有一半的底部按钮显示给我,scrollview没有进一步的功能。@gunessun它一直显示给我底部总共27个按钮9行,并且它是可滚动的。将此
android:scrollbars=“vertical”
添加到
滚动视图
。不起作用。看起来还是在左边。我把marginBottom放在最后的按钮上,但我不喜欢它。还有其他方法吗?是否将此布局放置在其他布局中?它是viewpager的一个页面。你认为这就是问题所在吗?发布集装箱布局哇,这很有效,谢谢。。。你能解释一下它为什么起作用吗?
<?xml version="1.0" encoding="utf-8"?>
<LinearLayout
    xmlns:android="http://schemas.android.com/apk/res/android"
    android:layout_width="match_parent"
    android:layout_height="match_parent"
    android:orientation="vertical">

    <android.support.v4.widget.NestedScrollView
        android:layout_width="match_parent"
        android:layout_height="wrap_content"
        android:fillViewport="true" >

        <LinearLayout
            android:layout_width="match_parent"
            android:layout_height="wrap_content"
            android:orientation="vertical">

            <LinearLayout
                android:layout_width="match_parent"
                android:layout_height="wrap_content"
                android:orientation="horizontal">

                <Button
                    android:layout_width="match_parent"
                    android:layout_height="75dp"
                    android:layout_weight="1"
                    android:textSize="15dp"
                    android:text="1"/>

                <Button
                    android:layout_width="match_parent"
                    android:layout_height="75dp"
                    android:layout_weight="1"
                    android:textSize="15dp"
                    android:text="2"/>

                <Button
                    android:layout_width="match_parent"
                    android:layout_height="75dp"
                    android:layout_weight="1"
                    android:textSize="15dp"
                    android:text="3"/>

            </LinearLayout>
            <LinearLayout
                android:layout_width="match_parent"
                android:layout_height="wrap_content"
                android:orientation="horizontal">

                <Button
                    android:layout_width="match_parent"
                    android:layout_height="75dp"
                    android:layout_weight="1"
                    android:textSize="15dp"
                    android:text="4"/>

                <Button
                    android:layout_width="match_parent"
                    android:layout_height="75dp"
                    android:layout_weight="1"
                    android:textSize="15dp"
                    android:text="5"/>

                <Button
                    android:layout_width="match_parent"
                    android:layout_height="75dp"
                    android:layout_weight="1"
                    android:textSize="15dp"
                    android:text="6"/>

            </LinearLayout>
            <LinearLayout
                android:layout_width="match_parent"
                android:layout_height="wrap_content"
                android:orientation="horizontal">

                <Button
                    android:layout_width="match_parent"
                    android:layout_height="75dp"
                    android:layout_weight="1"
                    android:textSize="15dp"
                    android:text="7"/>

                <Button
                    android:layout_width="match_parent"
                    android:layout_height="75dp"
                    android:layout_weight="1"
                    android:textSize="15dp"
                    android:text="8"/>

                <Button
                    android:layout_width="match_parent"
                    android:layout_height="75dp"
                    android:layout_weight="1"
                    android:textSize="15dp"
                    android:text="9"/>

            </LinearLayout>
            <LinearLayout
                android:layout_width="match_parent"
                android:layout_height="wrap_content"
                android:orientation="horizontal">

                <Button
                    android:layout_width="match_parent"
                    android:layout_height="75dp"
                    android:layout_weight="1"
                    android:textSize="15dp"
                    android:text="10"/>

                <Button
                    android:layout_width="match_parent"
                    android:layout_height="75dp"
                    android:layout_weight="1"
                    android:textSize="15dp"
                    android:text="11"/>

                <Button
                    android:layout_width="match_parent"
                    android:layout_height="75dp"
                    android:layout_weight="1"
                    android:textSize="15dp"
                    android:text="12"/>

            </LinearLayout>

            <LinearLayout
                android:layout_width="match_parent"
                android:layout_height="wrap_content"
                android:orientation="horizontal">

                <Button
                    android:layout_width="match_parent"
                    android:layout_height="75dp"
                    android:layout_weight="1"
                    android:textSize="15dp"
                    android:text="13"/>

                <Button
                    android:layout_width="match_parent"
                    android:layout_height="75dp"
                    android:layout_weight="1"
                    android:textSize="15dp"
                    android:text="14"/>

                <Button
                    android:layout_width="match_parent"
                    android:layout_height="75dp"
                    android:layout_weight="1"
                    android:textSize="15dp"
                    android:text="15"/>

            </LinearLayout>

            <LinearLayout
                android:layout_width="match_parent"
                android:layout_height="wrap_content"
                android:orientation="horizontal">

                <Button
                    android:layout_width="match_parent"
                    android:layout_height="75dp"
                    android:layout_weight="1"
                    android:textSize="15dp"
                    android:text="16"/>

                <Button
                    android:layout_width="match_parent"
                    android:layout_height="75dp"
                    android:layout_weight="1"
                    android:textSize="15dp"
                    android:text="17"/>

                <Button
                    android:layout_width="match_parent"
                    android:layout_height="75dp"
                    android:layout_weight="1"
                    android:textSize="15dp"
                    android:text="18"/>

            </LinearLayout>

            <LinearLayout
                android:layout_width="match_parent"
                android:layout_height="wrap_content"
                android:orientation="horizontal">

                <Button
                    android:layout_width="match_parent"
                    android:layout_height="75dp"
                    android:layout_weight="1"
                    android:textSize="15dp"
                    android:text="19"/>

                <Button
                    android:layout_width="match_parent"
                    android:layout_height="75dp"
                    android:layout_weight="1"
                    android:textSize="15dp"
                    android:text="20"/>

                <Button
                    android:layout_width="match_parent"
                    android:layout_height="75dp"
                    android:layout_weight="1"
                    android:textSize="15dp"
                    android:text="21"/>

            </LinearLayout>

            <LinearLayout
                android:layout_width="match_parent"
                android:layout_height="wrap_content"
                android:orientation="horizontal">

                <Button
                    android:layout_width="match_parent"
                    android:layout_height="75dp"
                    android:layout_weight="1"
                    android:textSize="15dp"
                    android:text="22"/>

                <Button
                    android:layout_width="match_parent"
                    android:layout_height="75dp"
                    android:layout_weight="1"
                    android:textSize="15dp"
                    android:text="23"/>

                <Button
                    android:layout_width="match_parent"
                    android:layout_height="75dp"
                    android:layout_weight="1"
                    android:textSize="15dp"
                    android:text="24"/>

            </LinearLayout>

            <LinearLayout
                android:layout_width="match_parent"
                android:layout_height="wrap_content"
                android:orientation="horizontal">

                <Button
                    android:layout_width="match_parent"
                    android:layout_height="75dp"
                    android:layout_weight="1"
                    android:textSize="15dp"
                    android:text="25"/>

                <Button
                    android:layout_width="match_parent"
                    android:layout_height="75dp"
                    android:layout_weight="1"
                    android:textSize="15dp"
                    android:text="26"/>

                <Button
                    android:layout_width="match_parent"
                    android:layout_height="75dp"
                    android:layout_weight="1"
                    android:textSize="15dp"
                    android:text="27"/>

            </LinearLayout>
        </LinearLayout>
    </android.support.v4.widget.NestedScrollView>
</LinearLayout>