I am getting familiar with the new support.design library and I'm facing this issue with the FloatingActionButton. I'm trying to hide it programmatically, but the button stay always visible.
I have the feeling that app:layout_anchor="@id/appbar" must override the visibility of the button.
JAVA:
@InjectView(R.id.search_fab)
FloatingActionButton search_fab;
[...]
search_fab.setVisibility(View.GONE);
XML:
<android.support.design.widget.AppBarLayout
android:id="@+id/appbar"
android:layout_width="match_parent"
android:layout_height="wrap_content"
android:fitsSystemWindows="true">
<android.support.design.widget.CollapsingToolbarLayout
android:id="@+id/collapsing_toolbar"
android:layout_width="match_parent"
android:layout_height="match_parent"
app:layout_scrollFlags="scroll|exitUntilCollapsed"
android:fitsSystemWindows="true"
app:contentScrim="?attr/colorPrimary"
app:expandedTitleMarginStart="48dp"
app:expandedTitleMarginEnd="64dp"
android:theme="@style/ToolBarStyle"
>
<android.support.v7.widget.RecyclerView
android:layout_width="match_parent"
android:layout_gravity="center"
android:layout_height="210dp"
android:id="@+id/top_sales_product_recycler_view"
/>
<android.support.v7.widget.Toolbar
android:id="@+id/toolbar"
android:layout_width="match_parent"
android:layout_height="?attr/actionBarSize"
app:popupTheme="@style/ThemeOverlay.AppCompat.Light"
app:layout_collapseMode="pin"
android:theme="@style/ToolBarStyle"
/>
</android.support.design.widget.CollapsingToolbarLayout>
</android.support.design.widget.AppBarLayout>
<android.support.v7.widget.RecyclerView
android:layout_width="match_parent"
android:layout_height="match_parent"
android:id="@+id/category_recycler_view"
app:layout_behavior="@string/appbar_scrolling_view_behavior"
/>
<android.support.design.widget.FloatingActionButton
android:layout_height="wrap_content"
android:layout_width="wrap_content"
app:layout_anchor="@id/appbar"
app:layout_anchorGravity="bottom|right|end"
android:src="@drawable/abc_ic_search_api_mtrl_alpha"
android:layout_margin="@dimen/fab_margin"
android:id="@+id/search_fab"
app:borderWidth="1dp"
/>
search_fab
– ShibbolethFAB
where visibility is ignored when running below lollipop. code.google.com/p/android/issues/detail?id=175331 – Portsalut