Android 带滚动视图的片段大小

Android 带滚动视图的片段大小,android,android-layout,xamarin,Android,Android Layout,Xamarin,嗨,伙计们。这是我目前的设计。左侧带有滚动视图和按钮的线性布局根据我放置的按钮数量不断扩展。我想做的是让它保持固定大小,让滚动视图工作。我一直在改变最小宽度和最小高度,甚至是固定大小的布局宽度和布局高度,但它仍然在不断扩展。知道我做错了什么吗?谢谢 <?xml version="1.0" encoding="utf-8"?> <LinearLayout xmlns:android="http://schemas.android.com/apk/res/android"

嗨,伙计们。这是我目前的设计。左侧带有滚动视图和按钮的线性布局根据我放置的按钮数量不断扩展。我想做的是让它保持固定大小,让滚动视图工作。我一直在改变最小宽度和最小高度,甚至是固定大小的布局宽度和布局高度,但它仍然在不断扩展。知道我做错了什么吗?谢谢

<?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:minWidth="800dp"
    android:minHeight="600dp"
    android:weightSum="100">
<!--Top Title Bar-->
    <LinearLayout
        android:orientation="horizontal"
        android:layout_width="match_parent"
        android:layout_height="0dp"
        android:layout_weight="15"
        android:weightSum="100"
        android:background="@drawable/AppBarBackground">
        <TextView
            android:id="@+id/tvCompanyName"
            android:fontFamily="@string/fontFamily"
            android:text="Reports"
            android:textColor="@color/white"
            android:layout_width="0dp"
            android:layout_height="match_parent"
            android:layout_weight="15"
            android:gravity="center|left"
            android:textSize="@dimen/textSizeSmall"
            android:textStyle="bold"
            android:paddingLeft="20dp"
            android:paddingRight="10dp" />
    </LinearLayout>
<!--Content Layout-->
    <LinearLayout
        android:orientation="horizontal"
        android:layout_width="match_parent"
        android:layout_height="0dp"
        android:layout_weight="85"
        android:weightSum="100">
    <!--Buttons Left Size-->
        <ScrollView
            android:layout_width="0dp"
            android:layout_height="match_parent"
            android:layout_weight="30"
            android:fillViewport="false">
            <LinearLayout
                android:orientation="vertical"
                android:layout_width="fill_parent"
                android:layout_height="0dp"
                android:layout_weight="1"
                android:background="@drawable/BackgroundWhite">
                <Button
                    android:id="@+id/btnXReadRpt"
                    android:textAllCaps="false"
                    android:fontFamily="@string/fontFamily"
                    android:layout_height="wrap_content"
                    android:layout_width="match_parent"
                    android:layout_gravity="center"
                    android:gravity="center"
                    android:background="@drawable/ButtonSelectorBorderBaseColor"
                    android:layout_marginLeft="5dp"
                    android:layout_marginRight="5dp"
                    android:textColor="@color/blue"
                    android:text="X-Read"
                    android:layout_marginTop="10dp"
                    android:layout_marginBottom="10dp"
                    android:layout_weight="5" />
                <Button
                    android:id="@+id/btnZReadRpt"
                    android:textAllCaps="false"
                    android:fontFamily="@string/fontFamily"
                    android:layout_height="wrap_content"
                    android:layout_width="match_parent"
                    android:layout_gravity="center"
                    android:gravity="center"
                    android:background="@drawable/ButtonSelectorBorderBaseColor"
                    android:layout_marginLeft="5dp"
                    android:layout_marginRight="5dp"
                    android:textColor="@color/blue"
                    android:text="Z-Read"
                    android:layout_marginTop="10dp"
                    android:layout_marginBottom="10dp"
                    android:layout_weight="5" />
                <Button
                    android:id="@+id/btnSalesRpt"
                    android:textAllCaps="false"
                    android:fontFamily="@string/fontFamily"
                    android:layout_height="wrap_content"
                    android:layout_width="match_parent"
                    android:layout_gravity="center"
                    android:gravity="center"
                    android:background="@drawable/ButtonSelectorBorderBaseColor"
                    android:layout_marginLeft="5dp"
                    android:layout_marginRight="5dp"
                    android:textColor="@color/blue"
                    android:text="Sales"
                    android:layout_marginTop="10dp"
                    android:layout_marginBottom="10dp"
                    android:layout_weight="5" />
                <Button
                    android:id="@+id/btnDiscountRpt"
                    android:textAllCaps="false"
                    android:fontFamily="@string/fontFamily"
                    android:layout_height="wrap_content"
                    android:layout_width="match_parent"
                    android:layout_gravity="center"
                    android:gravity="center"
                    android:background="@drawable/ButtonSelectorBorderBaseColor"
                    android:layout_marginLeft="5dp"
                    android:layout_marginRight="5dp"
                    android:textColor="@color/blue"
                    android:text="Discount"
                    android:layout_marginTop="10dp"
                    android:layout_marginBottom="10dp"
                    android:layout_weight="5" />
                <Button
                    android:id="@+id/btnItemVoidRpt"
                    android:textAllCaps="false"
                    android:fontFamily="@string/fontFamily"
                    android:layout_height="wrap_content"
                    android:layout_width="match_parent"
                    android:layout_gravity="center"
                    android:gravity="center"
                    android:background="@drawable/ButtonSelectorBorderBaseColor"
                    android:layout_marginLeft="5dp"
                    android:layout_marginRight="5dp"
                    android:textColor="@color/blue"
                    android:text="Item Void"
                    android:layout_marginTop="10dp"
                    android:layout_marginBottom="10dp"
                    android:layout_weight="5" />
                <Button
                    android:id="@+id/btnTransVoidRpt"
                    android:textAllCaps="false"
                    android:fontFamily="@string/fontFamily"
                    android:layout_height="wrap_content"
                    android:layout_width="match_parent"
                    android:layout_gravity="center"
                    android:gravity="center"
                    android:background="@drawable/ButtonSelectorBorderBaseColor"
                    android:layout_marginLeft="5dp"
                    android:layout_marginRight="5dp"
                    android:textColor="@color/blue"
                    android:text="Transaction Void"
                    android:layout_marginTop="10dp"
                    android:layout_marginBottom="10dp"
                    android:layout_weight="5" />
                <Button
                    android:id="@+id/btnZReadRpt"
                    android:textAllCaps="false"
                    android:fontFamily="@string/fontFamily"
                    android:layout_height="wrap_content"
                    android:layout_width="match_parent"
                    android:layout_gravity="center"
                    android:gravity="center"
                    android:background="@drawable/ButtonSelectorBorderBaseColor"
                    android:layout_marginLeft="5dp"
                    android:layout_marginRight="5dp"
                    android:textColor="@color/blue"
                    android:text="Z-Read"
                    android:layout_marginTop="10dp"
                    android:layout_marginBottom="10dp"
                    android:layout_weight="5" />
                <Button
                    android:id="@+id/btnSalesRpt"
                    android:textAllCaps="false"
                    android:fontFamily="@string/fontFamily"
                    android:layout_height="wrap_content"
                    android:layout_width="match_parent"
                    android:layout_gravity="center"
                    android:gravity="center"
                    android:background="@drawable/ButtonSelectorBorderBaseColor"
                    android:layout_marginLeft="5dp"
                    android:layout_marginRight="5dp"
                    android:textColor="@color/blue"
                    android:text="Sales"
                    android:layout_marginTop="10dp"
                    android:layout_marginBottom="10dp"
                    android:layout_weight="5" />
                <Button
                    android:id="@+id/btnDiscountRpt"
                    android:textAllCaps="false"
                    android:fontFamily="@string/fontFamily"
                    android:layout_height="wrap_content"
                    android:layout_width="match_parent"
                    android:layout_gravity="center"
                    android:gravity="center"
                    android:background="@drawable/ButtonSelectorBorderBaseColor"
                    android:layout_marginLeft="5dp"
                    android:layout_marginRight="5dp"
                    android:textColor="@color/blue"
                    android:text="Discount"
                    android:layout_marginTop="10dp"
                    android:layout_marginBottom="10dp"
                    android:layout_weight="5" />
                <Button
                    android:id="@+id/btnItemVoidRpt"
                    android:textAllCaps="false"
                    android:fontFamily="@string/fontFamily"
                    android:layout_height="wrap_content"
                    android:layout_width="match_parent"
                    android:layout_gravity="center"
                    android:gravity="center"
                    android:background="@drawable/ButtonSelectorBorderBaseColor"
                    android:layout_marginLeft="5dp"
                    android:layout_marginRight="5dp"
                    android:textColor="@color/blue"
                    android:text="Item Void"
                    android:layout_marginTop="10dp"
                    android:layout_marginBottom="10dp"
                    android:layout_weight="5" />
                <Button
                    android:id="@+id/btnTransVoidRpt"
                    android:textAllCaps="false"
                    android:fontFamily="@string/fontFamily"
                    android:layout_height="wrap_content"
                    android:layout_width="match_parent"
                    android:layout_gravity="center"
                    android:gravity="center"
                    android:background="@drawable/ButtonSelectorBorderBaseColor"
                    android:layout_marginLeft="5dp"
                    android:layout_marginRight="5dp"
                    android:textColor="@color/blue"
                    android:text="Transaction Void"
                    android:layout_marginTop="10dp"
                    android:layout_marginBottom="10dp"
                    android:layout_weight="5" />
            </LinearLayout>
        </ScrollView>
        <LinearLayout
            android:orientation="vertical"
            android:layout_width="0dp"
            android:layout_height="match_parent"
            android:layout_weight="70"
            android:weightSum="100"
            android:background="@drawable/BackgroundWhite" />
    </LinearLayout>
</LinearLayout>

如果您希望版面大小固定,则需要将高度和宽度设置为固定 i、 e

我想做的是让它保持固定大小,让滚动视图工作

尝试将固定大小设置为
ScrollView
,而不是使用
match\u parent

例如:

<ScrollView
    android:layout_width="0dp"
    android:layout_height="200dp"
    android:layout_weight="30"
    android:fillViewport="false">
...
</ScrollView>

...
结果是:

<ScrollView
    android:layout_width="0dp"
    android:layout_height="200dp"
    android:layout_weight="30"
    android:fillViewport="false">
...
</ScrollView>