Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

Coordinator Layout Overlapping Bottom Buttons

I am designing my XML and originally had a Coordinator Layout that was overlapping the Action ToolBar. I read around and found out taht adding the app:layout_behavior="@string/appbar_scrolling_view_behavior attribute helps resolve this issue.

However, in my XML I am still having an issue with the Coordinator Layout overlapping the bottom buttons on the Preview screen. I know these buttons are actually on the phone itself, but I am still puzzled why the layout is extending onto these items. See the below images overlapping the bottom buttons, I don't ever recall seeing this before the introduction of the Coordinator Layout:

<android.support.design.widget.AppBarLayout
    android:layout_width="match_parent"
    android:layout_height="wrap_content"
    android:theme="@style/AppTheme.AppBarOverlay">

    <android.support.v7.widget.Toolbar
        android:id="@+id/toolbar"
        android:layout_width="match_parent"
        android:layout_height="?attr/actionBarSize"
        android:background="?attr/colorPrimary"
        app:popupTheme="@style/AppTheme.PopupOverlay" />

</android.support.design.widget.AppBarLayout>


<LinearLayout
    android:layout_width="match_parent"
    android:layout_height="match_parent"
    android:orientation="vertical"
    app:layout_behavior="@string/appbar_scrolling_view_behavior">

    <ImageView
        android:layout_width="match_parent"
        android:layout_height="0dp"
        android:layout_weight="2.2" />

    <LinearLayout
        app:layout_behavior="@string/appbar_scrolling_view_behavior"
        android:layout_width="match_parent"
        android:orientation="vertical"
        android:layout_height="0dp"
        android:layout_weight="2">

        <TextView
            android:layout_width="match_parent"
            android:layout_height="wrap_content"
             />

        <CheckBox
            android:layout_width="match_parent"
            android:layout_height="wrap_content"
             />

    </LinearLayout>

    <LinearLayout
        android:layout_width="match_parent"
        android:layout_height="0dp"
        android:layout_weight="1.3">

    </LinearLayout>

</LinearLayout>

See the Layout overlapping the buttons

like image 863
tccpg288 Avatar asked Dec 02 '25 07:12

tccpg288


1 Answers

When you add app:layout_behavior="@string/appbar_scrolling_view_behavior" what it basically does is it sets that layout below the Toolbar and puts both the layout into a ScrollView kind of thing. Since there's a Toolbar on top of that layout hence, that entire layout (ScrollView that is formed) is pushed down by the height of the Toolbar.

like image 166
Suraj Kumar Sau Avatar answered Dec 04 '25 22:12

Suraj Kumar Sau



Donate For Us

If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!