android - Fragment layout with FAB conflict with CoordinatorLayout -


im using materialdrawer maindraweractivity replace each fragment inside container framelayout based on selected item, want add fab (just fragment) interacts coordinatorlayout can handle cool animations.

maindrawer 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.coordinatorlayout> 

how replace each fragment:

try {   supportfragmentmanager.begintransaction().replace(r.id.container, feedfragment()).commit() } catch (e: illegalstateexception) {   timber.i(e, "fragment still there.") } 

fragment layout:

<framelayout xmlns:android="http://schemas.android.com/apk/res/android"   xmlns:app="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.v7.widget.recyclerview     android:id="@+id/recyclerview"     android:layout_width="match_parent"     android:layout_height="match_parent"     android:scrollbaralwaysdrawverticaltrack="true"     android:scrollbars="vertical"     app:layout_behavior="@string/appbar_scrolling_view_behavior"     tools:listitem="@layout/feed_item" />    <android.support.design.widget.floatingactionbutton     android:layout_width="wrap_content"     android:layout_height="wrap_content"     android:layout_gravity="bottom|right"     android:layout_marginbottom="@dimen/spacing_medium"     android:layout_marginright="@dimen/spacing_medium"     android:elevation="@dimen/elevation_little"     app:fabsize="normal"     app:layout_anchor="@+id/container"     app:layout_anchorgravity="bottom|right"     app:layout_behavior="@string/appbar_scrolling_view_behavior"     app:srccompat="@drawable/ic_add_white_18dp" />  </framelayout> 

but result fab button behind bottom bar:

sample

im trying setting coordinator layout attribues (layout_anchor , those) match main layout ids not working... why?

define floating action button within activity - fragment's container considered parent.

fab should direct child of coordinatorlayout


Comments

Popular posts from this blog

Failed to execute goal org.apache.maven.plugins:maven-surefire-plugin:2.12:test (default-test) on project.Error occurred in starting fork -

windows - Debug iNetMgr.exe unhandle exception System.Management.Automation.CmdletInvocationException -

configurationsection - activeMq-5.13.3 setup configurations for wildfly 10.0.0 -