Clans / FloatingActionButton

Android Floating Action Button based on Material Design specification
Apache License 2.0
5.23k stars 1.13k forks source link

FloatingActionButton losses its properties on hideProgress #89

Open Ashok-Varma opened 9 years ago

Ashok-Varma commented 9 years ago

Hai i am using a fragment in one activity and this is it's XML file

<FrameLayout xmlns:android="http://schemas.android.com/apk/res/android" xmlns:fab="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.support.v4.widget.SwipeRefreshLayout
    android:id="@+id/swipeMovieRefresh"
    android:layout_width="match_parent"
    android:layout_height="match_parent"
    tools:context="com.ashokvarma.yifytorrentsyts.fragments.MainListFragment">

    <android.support.v7.widget.RecyclerView
        android:id="@+id/listViewMovies"
        android:layout_width="match_parent"
        android:layout_height="match_parent" />

    <TextView
        android:id="@+id/textVolleyError"
        android:layout_width="match_parent"
        android:layout_height="wrap_content"
        android:layout_gravity="center"
        android:gravity="center"
        android:padding="@dimen/size_word"
        android:visibility="gone" />

</android.support.v4.widget.SwipeRefreshLayout>

<com.github.clans.fab.FloatingActionButton
    android:id="@+id/fab_filter"
    android:layout_width="wrap_content"
    android:layout_height="wrap_content"
    android:layout_gravity="bottom|end"
    android:layout_marginBottom="16dp"
    android:layout_marginRight="16dp"
    android:layout_marginEnd="16dp"
    android:src="@drawable/fab_add"
    fab:fab_colorNormal="@color/PrimaryColor"
    fab:fab_colorPressed="@color/DarkPrimaryColor"
    fab:fab_colorRipple="@color/DarkPrimaryColor"
    />

In fragment

filterFAB = (FloatingActionButton) view.findViewById(R.id.fab_filter); filterFAB.setIndeterminate(true); filterFAB.setShowProgressBackground(false);

and when i called filterFAB.hideProgress() or filterFAB.setIndeterminate(false) on both calls the button is automatically moving to top left which is default for framelayout children. Instead it should stay on bottom right.

When i saw the layoutbounds to check whether the margin was still present or not, there are no layoutbounds at all not even for the button. then i removed hideProgress and checked again the layoutbounds kicked back in

Ashok-Varma commented 9 years ago

Now i linked that button with recyclerview onscroll method. And called fab.hideProgress()

on scrolling down the button is moving the postion that was for button to the top left corner again.