如何强制LinearLayout填充scrollView?

时间:2017-09-07 23:04:59

标签: android

我创建了两个级别的布局(因为某些设备有小屏幕) -

包含LinearLayout的ScrollView

出于某种原因,我无法让LinearLayout填充所有ScrollView,当我使用大屏幕时,我看到LinearLayout下方有一些差距

请...任何帮助:)

谢谢

 <ScrollView xmlns:android="http://schemas.android.com/apk/res/android"
            xmlns:tools="http://schemas.android.com/tools"
            android:layout_width="fill_parent"
            android:layout_height="fill_parent"
            tools:context=".MainActivity">

    <LinearLayout xmlns:android="http://schemas.android.com/apk/res/android"
        xmlns:tools="http://schemas.android.com/tools"
        xmlns:app="http://schemas.android.com/apk/res-auto"
        android:layout_width="match_parent"
        android:layout_height="match_parent"
        app:layout_behavior="@string/appbar_scrolling_view_behavior"
        tools:showIn="@layout/activity_main"
        android:orientation="vertical"
        android:id="@+id/topLinearLayout"/>

2 个答案:

答案 0 :(得分:2)

android:fill_viewport="true"添加到您的ScrollView

答案 1 :(得分:0)

将scrollView和LinearLayout上的layout_width和layout_height更改为wrap_content