android - CoordinatorLayout, FAB and container layout conflict -
i have main activity drawer have container layout
replace each fragment fragmentmanager
.
i want add fab 1 of child fragments hide/show on scroll im not sure im doing wrong , get:
layout:
<?xml version="1.0" encoding="utf-8"?> <android.support.design.widget.coordinatorlayout xmlns:android="http://schemas.android.com/apk/res/android" xmlns:app="http://schemas.android.com/apk/res-auto" android:layout_width="match_parent" android:layout_height="match_parent"> <android.support.design.widget.appbarlayout android:id="@+id/appbar" android:layout_width="match_parent" android:layout_height="wrap_content" android:fitssystemwindows="true" android:theme="@style/themeoverlay.appcompat.dark.actionbar"> <android.support.v7.widget.toolbar android:id="@+id/toolbar" android:layout_width="match_parent" android:layout_height="?actionbarsize" android:minheight="?actionbarsize" android:theme="@style/toolbar" app:layout_scrollflags="scroll|enteralways" /> </android.support.design.widget.appbarlayout> <framelayout android:id="@+id/container" android:layout_width="match_parent" android:layout_height="match_parent" app:layout_behavior="@string/appbar_scrolling_view_behavior" /> <android.support.design.widget.floatingactionbutton style="@style/widget.design.floatingactionbutton" android:layout_width="wrap_content" android:layout_height="wrap_content" android:layout_gravity="bottom|right|end" android:layout_marginbottom="@dimen/spacing_medium" android:layout_marginright="@dimen/spacing_medium" android:elevation="@dimen/elevation_little" app:fabsize="normal" app:layout_behavior="@string/appbar_scrolling_view_behavior" app:srccompat="@drawable/ic_add_white_18dp" /> </android.support.design.widget.coordinatorlayout>
looks
coordinatorlayout
cant handle behaviour of children views not "direct children".you need add
app:layout_anchorgravity="bottom|right|end"
,android:layout_gravity="end|bottom"
in fab view.
for example:
<android.support.design.widget.floatingactionbutton android:id="@+id/fab_feeds" android:layout_width="wrap_content" android:layout_height="wrap_content" android:layout_margin="16dp" android:clickable="true" android:layout_gravity="end|bottom" android:src="@drawable/ic_plus_white" app:layout_anchorgravity="bottom|right|end"/>
Comments
Post a Comment