0

I have created a Scroll view and it contains some Linear layouts that contains some views but issue is that the last view is not showing inside scroll view My Linear layout is not expending and android:fillViewport="true" is not working, i will post screen shot MY Output is

MY XML CODE IS

<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> 
10
  • stackoverflow.com/a/2606641/2798289 Commented Feb 3, 2015 at 12:42
  • i have give android:fillViewport="true" but it is not working, Commented Feb 3, 2015 at 12:43
  • add alignBottom to wrapper_button for scrollView , now the last item of scroll view is under button Commented Feb 3, 2015 at 12:46
  • i am not understating , can you explore a bit more? Commented Feb 3, 2015 at 12:50
  • Add this to your ScollView : android:layout_above="@id/wrapper_button" Commented Feb 3, 2015 at 12:53

2 Answers 2

2

Change height of ScrollView to wrap content or you can also put your ScrollView and the last LinearLayout into another LinearLayout having vertical orientation with fill_parent dimensions and add the weight property to both of them.

Sign up to request clarification or add additional context in comments.

2 Comments

I would suggest the second thing you said, it is a good option. But it should be match_parent instead of the deprecated fill_parent just to be picky
In my case, was enough to just "Change height of ScrollView to wrap content". Cool - thanks
0

Try this for your last Linear Layout

<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> 

1 Comment

This is not the best solution to add margin_bottom for fixing thisi issue

Start asking to get answers

Find the answer to your question by asking.

Ask question

Explore related questions

See similar questions with these tags.