0

So i've got this layout. The problem is that i would like to make the indicated view fill the remaining space and have something like the one on the top, so that it touches the edge of the screen.

I've tried everything but apart from setting a fixed height the view doesn't get showed.

How can i do it? Sorry if the xml is quite long, the view is at the end. Thank you.

<?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"
    xmlns:tools="http://schemas.android.com/tools"
    android:layout_width="match_parent"
    android:layout_height="match_parent"
    android:background="@color/white"
    android:id="@+id/coordinator_layout_new_configuration">

    <ScrollView
        android:layout_width="match_parent"
        android:layout_height="match_parent">

        <RelativeLayout
            android:id="@+id/relative_layout"
            android:layout_width="match_parent"
            android:layout_height="wrap_content">

            <View
                android:id="@+id/divider0"
                android:layout_width="1dp"
                android:layout_height="16dp"
                android:layout_marginBottom="8dp"
                android:layout_marginLeft="39dp"
                android:background="@color/md_grey_400" />

            <FrameLayout
                android:id="@+id/icon1"
                android:layout_width="wrap_content"
                android:layout_height="wrap_content"
                android:layout_below="@+id/divider0"
                android:layout_marginLeft="24dp"
                android:visibility="visible">

                <View
                    android:id="@+id/oval1"
                    android:layout_width="30dp"
                    android:layout_height="30dp"
                    android:background="@drawable/step_active" />

                <TextView
                    android:id="@+id/number1"
                    android:layout_width="wrap_content"
                    android:layout_height="wrap_content"
                    android:layout_gravity="center"
                    android:text="1"
                    android:textColor="@color/white" />

                <ImageView
                    android:id="@+id/done1"
                    android:layout_width="wrap_content"
                    android:layout_height="wrap_content"
                    android:layout_gravity="center"
                    android:src="@drawable/ic_done_white_24dp"
                    android:visibility="gone" />
            </FrameLayout>

            <ImageView
                android:id="@+id/warningIcon1"
                android:layout_width="30dp"
                android:layout_height="30dp"
                android:layout_marginLeft="24dp"
                android:layout_marginTop="24dp"
                android:src="@drawable/ic_warning_red_500_36dp"
                android:visibility="invisible" />

            <TextView
                android:id="@+id/title1"
                android:layout_width="wrap_content"
                android:layout_height="wrap_content"
                android:layout_alignTop="@+id/icon1"
                android:layout_marginLeft="16dp"
                android:layout_toRightOf="@+id/icon1"
                android:fontFamily="sans-serif-medium"
                android:text="@string/title1"
                android:textColor="@color/primary_text"
                android:textSize="16sp" />

            <TextView
                android:id="@+id/subtitle1"
                android:layout_width="wrap_content"
                android:layout_height="wrap_content"
                android:layout_below="@+id/title1"
                android:layout_marginLeft="16dp"
                android:layout_toRightOf="@+id/icon1"
                android:text="@string/subtitle1"
                android:textColor="@color/secondary_text"
                android:textSize="14sp" />

            <View
                android:id="@+id/divider1"
                android:layout_width="1dp"
                android:layout_height="153dp"
                android:layout_below="@+id/icon1"
                android:layout_marginLeft="39dp"
                android:layout_marginTop="8dp"
                android:background="@color/md_grey_400" />

            <android.support.design.widget.TextInputLayout
                android:id="@+id/textInputLayout1"
                android:layout_width="match_parent"
                android:layout_height="wrap_content"
                android:layout_alignLeft="@+id/title1"
                android:layout_below="@+id/subtitle1"
                android:layout_marginRight="24dp"
                android:layout_marginTop="16dp"
                android:layout_toRightOf="@+id/divider1">

                <EditText
                    android:id="@+id/editText1"
                    android:layout_width="match_parent"
                    android:layout_height="wrap_content"
                    android:hint="Name"
                    android:singleLine="true" />
            </android.support.design.widget.TextInputLayout>

            <Button
                android:id="@+id/button1"
                android:layout_width="wrap_content"
                android:layout_height="wrap_content"
                android:layout_alignLeft="@+id/textInputLayout1"
                android:layout_alignStart="@+id/textInputLayout1"
                android:layout_below="@+id/textInputLayout1"
                android:layout_marginBottom="48dp"
                android:backgroundTint="@color/colorAccent"
                android:paddingLeft="20dp"
                android:paddingRight="20dp"
                android:text="@string/step_continue"
                android:textColor="@color/white" />

            <Button
                android:id="@+id/button2"
                style="@style/Widget.AppCompat.Button.Borderless"
                android:layout_width="wrap_content"
                android:layout_height="wrap_content"
                android:layout_alignTop="@+id/button1"
                android:layout_marginLeft="8dp"
                android:layout_toRightOf="@+id/button1"
                android:paddingLeft="20dp"
                android:paddingRight="20dp"
                android:text="@string/step_cancel" />

            <FrameLayout
                android:id="@+id/icon2"
                android:layout_width="wrap_content"
                android:layout_height="wrap_content"
                android:layout_below="@+id/divider1"
                android:layout_marginLeft="24dp"
                android:layout_marginTop="8dp">

                <View
                    android:id="@+id/backgroundIcon2"
                    android:layout_width="30dp"
                    android:layout_height="30dp"
                    android:background="@drawable/step_inactive" />

                <TextView
                    android:id="@+id/number2"
                    android:layout_width="wrap_content"
                    android:layout_height="wrap_content"
                    android:layout_gravity="center"
                    android:text="2"
                    android:textColor="@color/white" />

                <ImageView
                    android:id="@+id/done2"
                    android:layout_width="wrap_content"
                    android:layout_height="wrap_content"
                    android:layout_gravity="center"
                    android:src="@drawable/ic_done_white_24dp"
                    android:visibility="gone" />
            </FrameLayout>

            <TextView
                android:id="@+id/title2"
                android:layout_width="wrap_content"
                android:layout_height="wrap_content"
                android:layout_alignTop="@+id/icon2"
                android:layout_marginLeft="16dp"
                android:layout_toRightOf="@+id/icon2"
                android:text="@string/title2"
                android:textColor="@color/primary_text"
                android:textSize="16sp" />

            <TextView
                android:id="@+id/subtitle2"
                android:layout_width="wrap_content"
                android:layout_height="wrap_content"
                android:layout_below="@+id/title2"
                android:layout_marginLeft="16dp"
                android:layout_toRightOf="@+id/icon2"
                android:text="@string/subtitle2"
                android:textColor="@color/secondary_text"
                android:textSize="14sp" />

            <View
                android:id="@+id/divider2"
                android:layout_width="1dp"
                android:layout_height="32dp"
                android:layout_below="@+id/icon2"
                android:layout_marginLeft="39dp"
                android:layout_marginTop="8dp"
                android:background="@color/md_grey_400" />

            <RelativeLayout
                android:id="@+id/relativeLayout1"
                android:layout_width="match_parent"
                android:layout_height="60dp"
                android:layout_alignLeft="@+id/subtitle2"
                android:layout_below="@+id/subtitle2"
                android:layout_marginRight="24dp"
                android:layout_marginTop="16dp"
                android:background="?android:attr/selectableItemBackground"
                android:clickable="true"
                android:visibility="gone">

                <ImageView
                    android:id="@+id/image1"
                    android:layout_width="wrap_content"
                    android:layout_height="wrap_content"
                    android:layout_centerVertical="true"
                    android:layout_marginLeft="16dp"
                    android:src="@drawable/ic_label_grey_24dp" />

                <TextView
                    android:id="@+id/textViewRelativeLayout1"
                    android:layout_width="wrap_content"
                    android:layout_height="wrap_content"
                    android:layout_centerVertical="true"
                    android:layout_marginLeft="24dp"
                    android:layout_toRightOf="@+id/image1"
                    android:text="@string/home"
                    android:textColor="@color/primary_text"
                    android:textSize="16sp" />
            </RelativeLayout>

            <Button
                android:id="@+id/button3"
                android:layout_width="wrap_content"
                android:layout_height="wrap_content"
                android:layout_alignLeft="@+id/relativeLayout1"
                android:layout_below="@+id/relativeLayout1"
                android:layout_marginBottom="48dp"
                android:backgroundTint="@color/colorAccent"
                android:paddingLeft="20dp"
                android:paddingRight="20dp"
                android:text="@string/step_continue"
                android:textColor="@color/white"
                android:visibility="gone" />

            <Button
                android:id="@+id/button4"
                style="@style/Widget.AppCompat.Button.Borderless"
                android:layout_width="wrap_content"
                android:layout_height="wrap_content"
                android:layout_alignTop="@+id/button3"
                android:layout_marginLeft="8dp"
                android:layout_toRightOf="@+id/button3"
                android:paddingLeft="20dp"
                android:paddingRight="20dp"
                android:text="@string/step_cancel"
                android:visibility="gone" />

            <FrameLayout
                android:id="@+id/icon3"
                android:layout_width="wrap_content"
                android:layout_height="wrap_content"
                android:layout_below="@+id/divider2"
                android:layout_marginLeft="24dp"
                android:layout_marginTop="8dp">

                <View
                    android:id="@+id/backgroundIcon3"
                    android:layout_width="30dp"
                    android:layout_height="30dp"
                    android:background="@drawable/step_inactive" />

                <TextView
                    android:id="@+id/number3"
                    android:layout_width="wrap_content"
                    android:layout_height="wrap_content"
                    android:layout_gravity="center"
                    android:text="3"
                    android:textColor="@color/white" />

                <ImageView
                    android:id="@+id/done3"
                    android:layout_width="wrap_content"
                    android:layout_height="wrap_content"
                    android:layout_gravity="center"
                    android:src="@drawable/ic_done_white_24dp"
                    android:visibility="gone" />
            </FrameLayout>

            <TextView
                android:id="@+id/title3"
                android:layout_width="wrap_content"
                android:layout_height="wrap_content"
                android:layout_alignTop="@+id/icon3"
                android:layout_marginLeft="16dp"
                android:layout_toRightOf="@+id/icon3"
                android:text="@string/title3"
                android:textColor="@color/primary_text"
                android:textSize="16sp" />

            <TextView
                android:id="@+id/subtitle3"
                android:layout_width="wrap_content"
                android:layout_height="wrap_content"
                android:layout_below="@+id/title3"
                android:layout_marginLeft="16dp"
                android:layout_toRightOf="@+id/icon3"
                android:text="@string/subtitle3"
                android:textColor="@color/secondary_text"
                android:textSize="14sp" />

            <View
                android:id="@+id/divider3"
                android:layout_width="1dp"
                android:layout_height="32dp"
                android:layout_below="@+id/icon3"
                android:layout_marginLeft="39dp"
                android:layout_marginTop="8dp"
                android:background="@color/md_grey_400" />

            <RelativeLayout
                android:id="@+id/relativeLayout2"
                android:layout_width="match_parent"
                android:layout_height="60dp"
                android:layout_alignLeft="@+id/subtitle3"
                android:layout_below="@+id/subtitle3"
                android:layout_marginRight="24dp"
                android:layout_marginTop="16dp"
                android:background="?android:attr/selectableItemBackground"
                android:clickable="true"
                android:visibility="gone">

                <ImageView
                    android:id="@+id/image2"
                    android:layout_width="wrap_content"
                    android:layout_height="wrap_content"
                    android:layout_centerVertical="true"
                    android:layout_marginLeft="16dp"
                    android:src="@drawable/ic_zoom_out_map_grey_24dp" />

                <TextView
                    android:id="@+id/textViewRelativeLayout2"
                    android:layout_width="wrap_content"
                    android:layout_height="wrap_content"
                    android:layout_centerVertical="true"
                    android:layout_marginLeft="24dp"
                    android:layout_toRightOf="@+id/image2"
                    android:text="@string/mid_tower"
                    android:textColor="@color/primary_text"
                    android:textSize="16sp" />
            </RelativeLayout>

            <Button
                android:id="@+id/button5"
                android:layout_width="wrap_content"
                android:layout_height="wrap_content"
                android:layout_alignLeft="@+id/relativeLayout2"
                android:layout_below="@+id/relativeLayout2"
                android:layout_marginBottom="48dp"
                android:backgroundTint="@color/colorAccent"
                android:paddingLeft="20dp"
                android:paddingRight="20dp"
                android:text="@string/step_continue"
                android:textColor="@color/white"
                android:visibility="gone" />

            <Button
                android:id="@+id/button6"
                style="@style/Widget.AppCompat.Button.Borderless"
                android:layout_width="wrap_content"
                android:layout_height="wrap_content"
                android:layout_alignTop="@+id/button5"
                android:layout_marginLeft="8dp"
                android:layout_toRightOf="@+id/button5"
                android:paddingLeft="20dp"
                android:paddingRight="20dp"
                android:text="@string/step_cancel"
                android:visibility="gone" />

            <FrameLayout
                android:id="@+id/icon4"
                android:layout_width="wrap_content"
                android:layout_height="wrap_content"
                android:layout_below="@+id/divider3"
                android:layout_marginLeft="24dp"
                android:layout_marginTop="8dp">

                <View
                    android:id="@+id/backgroundIcon4"
                    android:layout_width="30dp"
                    android:layout_height="30dp"
                    android:background="@drawable/step_inactive" />

                <TextView
                    android:id="@+id/number4"
                    android:layout_width="wrap_content"
                    android:layout_height="wrap_content"
                    android:layout_gravity="center"
                    android:text="4"
                    android:textColor="@color/white" />

                <ImageView
                    android:id="@+id/done4"
                    android:layout_width="wrap_content"
                    android:layout_height="wrap_content"
                    android:layout_gravity="center"
                    android:src="@drawable/ic_done_white_24dp"
                    android:visibility="gone" />
            </FrameLayout>

            <TextView
                android:id="@+id/title4"
                android:layout_width="wrap_content"
                android:layout_height="wrap_content"
                android:layout_alignTop="@+id/icon4"
                android:layout_marginLeft="16dp"
                android:layout_toRightOf="@+id/icon4"
                android:text="@string/title4"
                android:textColor="@color/primary_text"
                android:textSize="16sp" />

            <TextView
                android:id="@+id/subtitle4"
                android:layout_width="wrap_content"
                android:layout_height="wrap_content"
                android:layout_below="@+id/title4"
                android:layout_marginLeft="16dp"
                android:layout_toRightOf="@+id/icon4"
                android:text="@string/subtitle4"
                android:textColor="@color/secondary_text"
                android:textSize="14sp" />

            <View
                android:id="@+id/divider4"
                android:layout_width="1dp"
                android:layout_height="32dp"
                android:layout_below="@+id/icon4"
                android:layout_marginLeft="39dp"
                android:layout_marginTop="8dp"
                android:background="@color/md_grey_400" />

            <RelativeLayout
                android:id="@+id/relativeLayout3"
                android:layout_width="match_parent"
                android:layout_height="60dp"
                android:layout_alignLeft="@+id/subtitle4"
                android:layout_below="@+id/subtitle4"
                android:layout_marginRight="24dp"
                android:layout_marginTop="16dp"
                android:background="?android:attr/selectableItemBackground"
                android:clickable="true"
                android:visibility="gone">

                <ImageView
                    android:id="@+id/image3"
                    android:layout_width="wrap_content"
                    android:layout_height="wrap_content"
                    android:layout_centerVertical="true"
                    android:layout_marginLeft="16dp"
                    android:src="@drawable/ic_account_balance_wallet_grey_24dp" />

                <TextView
                    android:id="@+id/textViewRelativeLayout3"
                    android:layout_width="wrap_content"
                    android:layout_height="wrap_content"
                    android:layout_centerVertical="true"
                    android:layout_marginLeft="24dp"
                    android:layout_toRightOf="@+id/image3"
                    android:text="@string/home_mid_budget"
                    android:textColor="@color/primary_text"
                    android:textSize="16sp" />
            </RelativeLayout>

            <Button
                android:id="@+id/button7"
                android:layout_width="wrap_content"
                android:layout_height="wrap_content"
                android:layout_alignLeft="@+id/relativeLayout3"
                android:layout_below="@+id/relativeLayout3"
                android:layout_marginBottom="48dp"
                android:backgroundTint="@color/colorAccent"
                android:paddingLeft="20dp"
                android:paddingRight="20dp"
                android:text="@string/step_continue"
                android:textColor="@color/white"
                android:visibility="gone" />

            <Button
                android:id="@+id/button8"
                style="@style/Widget.AppCompat.Button.Borderless"
                android:layout_width="wrap_content"
                android:layout_height="wrap_content"
                android:layout_alignTop="@+id/button7"
                android:layout_marginLeft="8dp"
                android:layout_toRightOf="@+id/button7"
                android:paddingLeft="20dp"
                android:paddingRight="20dp"
                android:text="@string/step_cancel"
                android:visibility="gone" />

            <FrameLayout
                android:id="@+id/icon5"
                android:layout_width="wrap_content"
                android:layout_height="wrap_content"
                android:layout_below="@+id/divider4"
                android:layout_marginLeft="24dp"
                android:layout_marginTop="8dp">

                <View
                    android:id="@+id/backgroundIcon5"
                    android:layout_width="30dp"
                    android:layout_height="30dp"
                    android:background="@drawable/step_inactive" />

                <TextView
                    android:id="@+id/number5"
                    android:layout_width="wrap_content"
                    android:layout_height="wrap_content"
                    android:layout_gravity="center"
                    android:text="5"
                    android:textColor="@color/white" />
            </FrameLayout>

            <TextView
                android:id="@+id/title5"
                android:layout_width="wrap_content"
                android:layout_height="wrap_content"
                android:layout_alignTop="@+id/icon5"
                android:layout_marginLeft="16dp"
                android:layout_toRightOf="@+id/icon5"
                android:text="@string/title5"
                android:textColor="@color/primary_text"
                android:textSize="16sp" />

            <TextView
                android:id="@+id/subtitle5"
                android:layout_width="wrap_content"
                android:layout_height="wrap_content"
                android:layout_below="@+id/title5"
                android:layout_marginLeft="16dp"
                android:layout_toRightOf="@+id/icon5"
                android:text="@string/subtitle5"
                android:textColor="@color/secondary_text"
                android:textSize="14sp" />

            <Button
                android:id="@+id/button9"
                android:layout_width="wrap_content"
                android:layout_height="wrap_content"
                android:layout_alignLeft="@+id/subtitle5"
                android:layout_below="@+id/subtitle5"
                android:layout_marginBottom="48dp"
                android:layout_marginTop="16dp"
                android:backgroundTint="@color/colorAccent"
                android:paddingLeft="20dp"
                android:paddingRight="20dp"
                android:text="@string/step_finish"
                android:textColor="@color/white"
                android:visibility="gone" />

            <Button
                android:id="@+id/button10"
                style="@style/Widget.AppCompat.Button.Borderless"
                android:layout_width="wrap_content"
                android:layout_height="wrap_content"
                android:layout_alignTop="@+id/button9"
                android:layout_marginLeft="8dp"
                android:layout_toRightOf="@+id/button9"
                android:paddingLeft="20dp"
                android:paddingRight="20dp"
                android:text="@string/step_cancel"
                android:visibility="gone" />

                <!--this one-->
                <View
                    android:id="@+id/divider5"
                    android:layout_width="1dp"
                    android:layout_height="50dp"
                    android:layout_below="@id/icon5"
                    android:layout_marginLeft="39dp"
                    android:layout_marginTop="8dp"
                    android:background="@color/md_grey_400" />

        </RelativeLayout>
    </ScrollView>
</android.support.design.widget.CoordinatorLayout>
oxcened
  • 165
  • 1
  • 8
  • have you considered using `layout_weight` attribute? but this will require to change the parent to a `Linear layout`! – Atef Hares Mar 13 '17 at 02:18
  • yes but which of them ? i've got also a scroll view. thank you for the answer. – oxcened Mar 13 '17 at 02:21
  • the **direct parent** of the view that you are talking about [the separator], my best guess, you have to change either the `FrameLayout` or the `RelativeLayout` depending on which you view you meant ! – Atef Hares Mar 13 '17 at 02:26
  • Also see [What does android:layout_weight mean?](https://stackoverflow.com/questions/3995825/what-does-androidlayout-weight-mean) **and** [Docs](https://developer.android.com/guide/topics/ui/layout/linear.html) – Atef Hares Mar 13 '17 at 02:27
  • thank you i already know the weight property but i'm having trouble trying to apply it on this layout since it's pretty complex to me. i will see what i can do – oxcened Mar 13 '17 at 02:31
  • ok so i managed to do it by putting the parent layout (relative) and the view into another relative layout, so that the relative layout and the view are siblings in the parent relative layout. then setting the view height to wrap_content it actually reaches the end of the screen. the only issue is that this only works after i've removed the scroll view. any idea? – oxcened Mar 13 '17 at 02:59
  • YAY. Found [this](http://stackoverflow.com/a/2606641/7582149) – oxcened Mar 13 '17 at 03:15
  • Great!, `android:fillViewport="true"` has always been useful to me – Atef Hares Mar 13 '17 at 03:29

0 Answers0