About Android support design library

Asked 2 years ago, Updated 2 years ago, 111 views

I created the following layout using Android support design library.However, FloationActionButton does not slide up when Snackbar is displayed.Please advise where to fix the slide.I look forward to your kind cooperation.

Layout

<android.support.design.widget.CoordinatorLayout xmlns:android="http://schemas.android.com/apk/res/android"
    android:id="@+id/root_view"
    xmlns:tools="http://schemas.android.com/tools"
    android:layout_width="match_parent"
    android:layout_height="match_parent"
    xmlns:app="http://schemas.android.com/apk/res-auto">

    <android.support.design.widget.AppBarLayout
        android:layout_width="match_parent"
        android:layout_height="200dp"
        android:fitsSystemWindows="true">

        <android.support.design.widget.CollappingToolbarLayout
            android: id="@+id/collapsing_toolbar"
            android:layout_width="match_parent"
            android:layout_height="match_parent"
            app:contentScrim="@color/primary_color"
            app:layout_scrollFlags="scroll | exitUntilCollapsed">
            <TextView
                android: id="@+id/ex_text"
                android:layout_width="match_parent"
                android:layout_height="match_parent"
                app:layout_collapseMode="parallax"
                android:background="@color/accent_color"
                android: text="@string/kawiais_ex_text"
                android:textSize="16sp"
                android:gravity="center"
                android:paddingLeft="24dp"
                android:paddingRight="24dp"
                android:textColor="@android:color/white"/>
            <android.support.v7.widget.Toolbar
                android: id="@+id/toolbar"
                android:layout_width="match_parent"
                android:layout_height="?attr/actionBarSize"
                app:theme="@style/ThemeOverlay.AppCompat.ActionBar"
                app:layout_scrollFlags="scroll|enterAllways"
                app: title="@string/title_kaiwai_list"
                app:layout_collapseMode="pin"/>
        </android.support.design.widget.CollappingToolbarLayout>
    </android.support.design.widget.AppBarLayout>

    <android.support.v7.widget.RecyclerView
        android:id="@+id/recycler"
        android:layout_width="match_parent"
        android:layout_height="wrap_content"
        app:layout_behavior="@string/appbar_scrolling_view_behavior"/>



    <android.support.design.widget.FloatingActionButton
        android: id="@+id/fab"
        android:layout_width="wrap_content"
        android:layout_height="wrap_content"
        android:layout_gravity="bottom|end"
        android:layout_margin="16dp"
        android: src="@drawable/ic_add_white"
        app:fabSize="normal"
        app: borderWidth="0dp"
        app:backgroundTint="@color/fab_color"/>

    <com.rey.material.widget.ProgressView
        android: id="@+id/progress"
        android:layout_width="@dimen/progress_size"
        android:layout_height="@dimen/progress_size"
        app:pv_progressMode="indeterminate"
        app:pv_progressStyle="@style/progress_style"
        app:pv_autostart="true"
        app: pv_circular="true"
        android:layout_gravity="center"/>

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

android android-support-library

2022-09-30 20:56

1 Answers

<android.support.design.widget.FloatingActionButton
    ...
    android:layout_gravity="bottom|end"
    ...
    />

Try the following:

<android.support.design.widget.FloatingActionButton
    ...
    app:layout_anchor="@id/recycler"
    app: layout_anchorGravity="right|bottom"
    ...
    />


2022-09-30 20:56

If you have any answers or tips


© 2024 OneMinuteCode. All rights reserved.