我创建了一个Scroll视图,它包含一些包含一些视图 的线性布局,但问题是最后一个视图没有显示在滚动视图中我的线性布局没有消耗 和 android:fillViewport =" true" 无效,我会发布截图 我的输出是
我的XML代码
<RelativeLayout 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="fill_parent"
android:layout_height="fill_parent"
android:orientation="vertical" >
<android.support.v7.widget.Toolbar
android:id="@+id/toolbar_filters"
android:layout_width="match_parent"
android:layout_height="wrap_content"
android:background="#2f3f9f"
android:minHeight="?attr/actionBarSize"
app:popupTheme="@style/ThemeOverlay.AppCompat.Light"
app:theme="@style/ThemeOverlay.AppCompat.Dark.ActionBar" >
<TextView
android:id="@+id/toolbar_title"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:layout_gravity="center"
android:text="FILTERS"
android:textAppearance="?android:attr/textAppearanceLarge"
android:textColor="@color/white" />
</android.support.v7.widget.Toolbar>
<ScrollView
android:layout_width="fill_parent"
android:layout_height="fill_parent"
android:fillViewport="true"
android:layout_below="@+id/toolbar_filters"
android:background="#202231" >
<LinearLayout
android:layout_width="match_parent"
android:layout_height="match_parent"
android:background="#202231"
android:orientation="vertical" >
<LinearLayout
android:layout_width="match_parent"
android:layout_height="wrap_content"
android:layout_marginTop="15dp"
android:background="#2a2d41"
android:orientation="horizontal"
android:weightSum="2" >
<LinearLayout
android:layout_width="match_parent"
android:layout_height="wrap_content"
android:layout_weight="1"
android:orientation="vertical" >
<TextView
android:id="@+id/open_now"
android:layout_width="match_parent"
android:layout_height="wrap_content"
android:gravity="left"
android:paddingBottom="5dp"
android:paddingLeft="20dp"
android:paddingTop="5dp"
android:text="Opne Now"
android:textAppearance="?android:attr/textAppearanceMedium"
android:textColor="@color/white" />
<View
android:id="@+id/view_open_now"
android:layout_width="match_parent"
android:layout_height="2dp"
android:background="#2a2d41" />
<TextView
android:id="@+id/smoking_inside"
android:layout_width="match_parent"
android:layout_height="wrap_content"
android:gravity="left"
android:paddingBottom="5dp"
android:paddingLeft="20dp"
android:paddingTop="10dp"
android:text="Smoking Inside"
android:textAppearance="?android:attr/textAppearanceMedium"
android:textColor="@color/white" />
<View
android:id="@+id/view_smoking_inside"
android:layout_width="match_parent"
android:layout_height="2dp"
android:background="#2a2d41" />
<TextView
android:id="@+id/shots"
android:layout_width="match_parent"
android:layout_height="wrap_content"
android:gravity="left"
android:paddingBottom="5dp"
android:paddingLeft="20dp"
android:paddingTop="10dp"
android:text="Shots"
android:textAppearance="?android:attr/textAppearanceMedium"
android:textColor="@color/white" />
<View
android:id="@+id/view_shots"
android:layout_width="match_parent"
android:layout_height="2dp"
android:background="#2a2d41" />
<TextView
android:id="@+id/vvip"
android:layout_width="match_parent"
android:layout_height="wrap_content"
android:gravity="left"
android:paddingBottom="5dp"
android:paddingLeft="20dp"
android:paddingTop="10dp"
android:text="VVIP"
android:textAppearance="?android:attr/textAppearanceMedium"
android:textColor="@color/white" />
<View
android:id="@+id/view_vvip"
android:layout_width="match_parent"
android:layout_height="2dp"
android:background="#2a2d41" />
<TextView
android:id="@+id/terrace"
android:layout_width="match_parent"
android:layout_height="wrap_content"
android:gravity="left"
android:paddingBottom="5dp"
android:paddingLeft="20dp"
android:paddingTop="10dp"
android:text="Terrace"
android:textAppearance="?android:attr/textAppearanceMedium"
android:textColor="@color/white" />
<View
android:id="@+id/view_terrace"
android:layout_width="match_parent"
android:layout_height="2dp"
android:background="#2a2d41" />
</LinearLayout>
<View
android:id="@+id/view_vertical"
android:layout_width="2dp"
android:layout_height="match_parent"
android:background="#2a2d41" />
<LinearLayout
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:layout_weight="1"
android:orientation="vertical" >
<TextView
android:id="@+id/karoake"
android:layout_width="match_parent"
android:layout_height="wrap_content"
android:gravity="left"
android:paddingBottom="5dp"
android:paddingLeft="20dp"
android:paddingTop="5dp"
android:text="Karaoke"
android:textAppearance="?android:attr/textAppearanceMedium"
android:textColor="@color/white" />
<View
android:id="@+id/view_karoake"
android:layout_width="match_parent"
android:layout_height="2dp"
android:background="#2a2d41" />
<TextView
android:id="@+id/cigar"
android:layout_width="match_parent"
android:layout_height="wrap_content"
android:gravity="left"
android:paddingBottom="5dp"
android:paddingLeft="20dp"
android:paddingTop="10dp"
android:text="Cigar"
android:textAppearance="?android:attr/textAppearanceMedium"
android:textColor="@color/white" />
<View
android:id="@+id/view_cigar"
android:layout_width="match_parent"
android:layout_height="2dp"
android:background="#2a2d41" />
<TextView
android:id="@+id/vip"
android:layout_width="match_parent"
android:layout_height="wrap_content"
android:gravity="left"
android:paddingBottom="5dp"
android:paddingLeft="20dp"
android:paddingTop="10dp"
android:text="VIP"
android:textAppearance="?android:attr/textAppearanceMedium"
android:textColor="@color/white" />
<View
android:id="@+id/view_vip"
android:layout_width="match_parent"
android:layout_height="2dp"
android:background="#2a2d41" />
<TextView
android:id="@+id/sea_side"
android:layout_width="match_parent"
android:layout_height="wrap_content"
android:gravity="left"
android:paddingBottom="5dp"
android:paddingLeft="20dp"
android:paddingTop="10dp"
android:text="Sea Side"
android:textAppearance="?android:attr/textAppearanceMedium"
android:textColor="@color/white" />
<View
android:id="@+id/view_sea_side"
android:layout_width="match_parent"
android:layout_height="2dp"
android:background="#2a2d41" />
<TextView
android:id="@+id/swimming_pool"
android:layout_width="match_parent"
android:layout_height="wrap_content"
android:gravity="left"
android:paddingBottom="5dp"
android:paddingLeft="20dp"
android:paddingTop="10dp"
android:text="Swimming Pool"
android:textAppearance="?android:attr/textAppearanceMedium"
android:textColor="@color/white" />
<View
android:id="@+id/view_swimming_pool"
android:layout_width="match_parent"
android:layout_height="2dp"
android:background="#2a2d41" />
</LinearLayout>
</LinearLayout>
<LinearLayout
android:id="@+id/music_selection_view"
android:layout_width="match_parent"
android:layout_height="wrap_content"
android:layout_marginTop="15dp"
android:background="#2a2d41"
android:orientation="horizontal" >
<TextView
android:id="@+id/filter_music"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:layout_marginBottom="5dp"
android:layout_marginLeft="20dp"
android:layout_marginTop="5dp"
android:layout_weight="1"
android:gravity="left"
android:text="Music"
android:textAppearance="?android:attr/textAppearanceMedium"
android:textColor="@color/white" />
<TextView
android:id="@+id/filter_music_count"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:layout_marginBottom="5dp"
android:layout_marginTop="5dp"
android:gravity="right"
android:paddingRight="8dp"
android:text="(0)"
android:textAppearance="?android:attr/textAppearanceLarge"
android:textColor="@color/white" />
<TextView
android:id="@+id/filter_music_fonts"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:layout_marginBottom="5dp"
android:layout_marginTop="5dp"
android:gravity="right"
android:paddingRight="8dp"
android:text=">"
android:textAppearance="?android:attr/textAppearanceLarge"
android:textColor="@color/white" />
</LinearLayout>
<LinearLayout
android:id="@+id/cuisine_layouts"
android:layout_width="match_parent"
android:layout_height="wrap_content"
android:layout_marginTop="15dp"
android:background="#2a2d41"
android:orientation="horizontal" >
<TextView
android:id="@+id/filter_cuisines"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:layout_marginBottom="5dp"
android:layout_marginLeft="20dp"
android:layout_marginTop="5dp"
android:layout_weight="1"
android:gravity="left"
android:text="Cuisines"
android:textAppearance="?android:attr/textAppearanceMedium"
android:textColor="@color/white" />
<TextView
android:id="@+id/filter_cuisines_count"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:layout_marginBottom="5dp"
android:layout_marginTop="5dp"
android:gravity="right"
android:paddingRight="8dp"
android:text="(0)"
android:textAppearance="?android:attr/textAppearanceLarge"
android:textColor="@color/white" />
<TextView
android:id="@+id/filter_cuisines_fonts"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:layout_marginBottom="5dp"
android:layout_marginTop="5dp"
android:gravity="right"
android:paddingRight="8dp"
android:text=">"
android:textAppearance="?android:attr/textAppearanceLarge"
android:textColor="@color/white" />
</LinearLayout>
<LinearLayout
android:id="@+id/outlet_type_layouts"
android:layout_width="match_parent"
android:layout_height="wrap_content"
android:layout_marginTop="15dp"
android:background="#2a2d41"
android:orientation="horizontal" >
<TextView
android:id="@+id/filter_type"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:layout_marginBottom="5dp"
android:layout_marginLeft="20dp"
android:layout_marginTop="5dp"
android:layout_weight="1"
android:gravity="left"
android:text="Type"
android:textAppearance="?android:attr/textAppearanceMedium"
android:textColor="@color/white" />
<TextView
android:id="@+id/filter_type_count"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:layout_marginBottom="5dp"
android:layout_marginTop="5dp"
android:gravity="right"
android:paddingRight="8dp"
android:text="(0)"
android:textAppearance="?android:attr/textAppearanceLarge"
android:textColor="@color/white" />
<TextView
android:id="@+id/filter_type_fonts"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:layout_marginBottom="5dp"
android:layout_marginTop="5dp"
android:gravity="right"
android:paddingRight="8dp"
android:text=">"
android:textAppearance="?android:attr/textAppearanceLarge"
android:textColor="@color/white" />
</LinearLayout>
<LinearLayout
android:layout_width="match_parent"
android:layout_height="wrap_content"
android:layout_marginTop="15dp"
android:background="#2a2d41"
android:orientation="horizontal" >
<LinearLayout
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:orientation="horizontal" >
<TextView
android:id="@+id/filter_cover_charges_upto"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:layout_marginBottom="5dp"
android:layout_marginLeft="20dp"
android:layout_marginTop="5dp"
android:gravity="left"
android:text="COVER CHARGES UPTO"
android:textAppearance="?android:attr/textAppearanceMedium"
android:textColor="@color/white" />
<View
android:layout_width="wrap_content"
android:layout_height="0dp"
android:layout_weight="1" />
<TextView
android:id="@+id/filter_cover_charges_upto_value"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:layout_marginBottom="5dp"
android:layout_marginRight="5dp"
android:layout_marginTop="5dp"
android:background="@drawable/back"
android:gravity="left"
android:paddingLeft="4dp"
android:paddingRight="4dp"
android:text="50"
android:textAppearance="?android:attr/textAppearanceMedium"
android:textColor="@color/white" />
</LinearLayout>
<LinearLayout
android:layout_width="match_parent"
android:layout_height="wrap_content"
android:orientation="horizontal" >
<TextView
android:id="@+id/seekBar_value_min"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:layout_marginLeft="15dp"
android:layout_marginTop="5dp"
android:gravity="top"
android:text="0"
android:textAppearance="?android:attr/textAppearanceSmall"
android:textColor="@color/white" />
<SeekBar
android:id="@+id/seekBar1"
android:layout_width="0dp"
android:layout_height="wrap_content"
android:layout_gravity="center_vertical"
android:layout_weight="1"
android:max="999" />
<TextView
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:layout_marginRight="5dp"
android:layout_marginTop="5dp"
android:gravity="top"
android:text="999"
android:textAppearance="?android:attr/textAppearanceSmall"
android:textColor="@color/white" />
</LinearLayout>
</LinearLayout>
<LinearLayout
android:layout_width="match_parent"
android:layout_height="wrap_content"
android:layout_marginTop="15dp"
android:background="#2a2d41"
android:orientation="horizontal" >
<TextView
android:id="@+id/filter_guest_list"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:layout_marginBottom="5dp"
android:layout_marginLeft="20dp"
android:layout_marginTop="5dp"
android:layout_weight="1"
android:gravity="left"
android:text="GUESTLIST UPTO"
android:textAppearance="?android:attr/textAppearanceMedium"
android:textColor="@color/white" />
<TextView
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:layout_marginBottom="5dp"
android:layout_marginTop="5dp"
android:layout_weight="1"
android:gravity="right"
android:paddingRight="2dp"
android:text="23:30"
android:textAppearance="?android:attr/textAppearanceMedium"
android:textColor="@color/white" />
<TextView
android:id="@+id/filter_arrow_fonts"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:layout_marginBottom="5dp"
android:layout_marginTop="5dp"
android:gravity="right"
android:paddingRight="8dp"
android:text=">"
android:textAppearance="?android:attr/textAppearanceLarge"
android:textColor="@color/white" />
</LinearLayout>
</LinearLayout>
</ScrollView>
<LinearLayout
android:id="@+id/wrapper_button"
android:layout_width="fill_parent"
android:layout_height="wrap_content"
android:layout_alignParentBottom="true"
android:layout_centerHorizontal="true"
android:orientation="horizontal" >
<Button
android:id="@+id/activate_plans_btn"
android:layout_width="match_parent"
android:layout_height="wrap_content"
android:background="#2f3f9f"
android:text="SUBMIT"
android:textAppearance="?android:attr/textAppearanceMedium"
android:textColor="#ffffff" />
</LinearLayout>
</RelativeLayout>
答案 0 :(得分:1)
更改ScrollView的高度以包装内容,或者您也可以将ScrollView和最后一个LinearLayout放入另一个具有fill_parent维度的垂直方向的LinearLayout中,并将weight属性添加到它们中。
答案 1 :(得分:0)
尝试使用最后一个线性布局
<LinearLayout
android:layout_width="match_parent"
android:layout_height="wrap_content"
android:layout_marginTop="15dp"
android:layout_marginBottom="20dp"
android:background="#2a2d41"
android:orientation="horizontal" >
<TextView
android:id="@+id/filter_guest_list"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:layout_marginBottom="5dp"
android:layout_marginLeft="20dp"
android:layout_marginTop="5dp"
android:layout_weight="1"
android:gravity="left"
android:text="GUESTLIST UPTO"
android:textAppearance="?android:attr/textAppearanceMedium"
android:textColor="@color/white" />
<TextView
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:layout_marginBottom="5dp"
android:layout_marginTop="5dp"
android:layout_weight="1"
android:gravity="right"
android:paddingRight="2dp"
android:text="23:30"
android:textAppearance="?android:attr/textAppearanceMedium"
android:textColor="@color/white" />
<TextView
android:id="@+id/filter_arrow_fonts"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:layout_marginBottom="5dp"
android:layout_marginTop="5dp"
android:gravity="right"
android:paddingRight="8dp"
android:text=">"
android:textAppearance="?android:attr/textAppearanceLarge"
android:textColor="@color/white" />
</LinearLayout>