تابستون داره تموم میشه ها، فرصت‌ها محدودن کلی آفر جذاب در کمپین تابستون🔥👇
۰ ثانیه
۰ دقیقه
۰ ساعت
۲ MohammadJavad Khoshneshin
SnackBar vs FloatActionButton
پوریا شفیعی حل شده توسط پوریا شفیعی

سلام و عرض ادب . با اینکه روت فایل من coordinator هست ولی اسنک بار روی FloatActionButton میاد و هیچ انیمیشن هم که به بالا دکمه رو انتقال بده اجرا نمیشه.’

<?xml version="1.0" encoding="utf-8"?>
<androidx.coordinatorlayout.widget.CoordinatorLayout xmlns:android="http://schemas.android.com/apk/res/android"
    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">
    <com.google.android.material.appbar.AppBarLayout
        android:layout_width="match_parent"
        android:layout_height="wrap_content">
        <androidx.appcompat.widget.Toolbar
            android:layout_width="match_parent"
            android:layout_height="wrap_content"
            app:layout_scrollFlags="scroll|enterAlways"
            app:title="Android Expert"
            app:titleTextColor="@android:color/white"/>
    </com.google.android.material.appbar.AppBarLayout>
    <androidx.core.widget.NestedScrollView
        android:layout_width="match_parent"
        android:layout_height="match_parent"
        app:layout_behavior="com.google.android.material.appbar.AppBarLayout$ScrollingViewBehavior">
        <LinearLayout
            android:layout_width="match_parent"
            android:layout_height="wrap_content"
            android:orientation="vertical">
            <include layout="@layout/item_text"/>
            <include layout="@layout/item_text"/>
            <include layout="@layout/item_text"/>
            <include layout="@layout/item_text"/>
            <include layout="@layout/item_text"/>
            <include layout="@layout/item_text"/>
            <include layout="@layout/item_text"/>
            <include layout="@layout/item_text"/>
            <include layout="@layout/item_text"/>
            <include layout="@layout/item_text"/>
            <include layout="@layout/item_text"/>
        </LinearLayout>
    </androidx.core.widget.NestedScrollView>
    <com.google.android.material.floatingactionbutton.FloatingActionButton
        android:id="@+id/fab_main"
        android:layout_width="wrap_content"
        android:layout_height="wrap_content"
        app:srcCompat = "@drawable/layer_vector_ic"
        android:layout_gravity="bottom|end"
        android:layout_marginEnd="16dp"
        android:layout_marginBottom="20dp"
        tools:ignore="VectorDrawableCompat"
        app:tint="@android:color/white"
        app:layout_behavior="com.google.android.material.behavior.HideBottomViewOnScrollBehavior"
        app:fabSize="auto"
        app:rippleColor="#8AFFFFFF"
        />
</androidx.coordinatorlayout.widget.CoordinatorLayout>
MohammadJavad Khoshneshin ۰۳ اسفند ۱۳۹۹، ۱۹:۵۰

سلام وقت بخیر

 

اتربیوت app:layout_behavior رو به اشتباه به FloatActionButton اضافه کردید.

فایل تصحیح شده پیوست شد.

app:layout_behavior="com.google.android.material.behavior.HideBottomViewOnScrollBehavior"
بهترین پاسخ
پوریا شفیعی ۰۳ اسفند ۱۳۹۹، ۲۰:۳۷