If you use this in CollapsingToolbarLayout , you can do this:
<android.support.design.widget.CollapsingToolbarLayout android:id="@+id/toolbarCollapse" android:layout_width="match_parent" android:layout_height="match_parent" android:fitsSystemWindows="true" app:contentScrim="?attr/colorPrimary" app:layout_scrollFlags="scroll|exitUntilCollapsed"> <RelativeLayout android:layout_width="match_parent" android:layout_height="wrap_content"> <ImageView android:layout_width="match_parent" android:layout_height="190dp" android:background="@android:color/darker_gray" android:minHeight="190dp" android:src="@drawable/ic_email" app:layout_collapseMode="parallax" android:id="@+id/imageView8" /> <android.support.design.widget.FloatingActionButton android:id="@+id/fabmain" android:layout_width="wrap_content" android:layout_height="wrap_content" android:layout_gravity="bottom|end" android:src="@drawable/ic_add" app:backgroundTint="@color/ColorAccent" app:borderWidth="0dp" app:fabSize="mini" app:layout_anchor="@id/app_bar_layout" app:layout_anchorGravity="bottom|end" android:layout_marginLeft="16dp" android:layout_marginRight="16dp" android:layout_alignTop="@+id/fabmain2" android:layout_toStartOf="@+id/fabmain2" android:layout_marginEnd="20dp" /> <android.support.design.widget.FloatingActionButton android:id="@+id/fabmain2" android:layout_width="wrap_content" android:layout_height="wrap_content" android:layout_gravity="bottom|end" android:layout_marginLeft="16dp" android:src="@drawable/ic_add" app:backgroundTint="@color/ColorAccent" app:borderWidth="0dp" app:fabSize="mini" app:layout_anchor="@id/app_bar_layout" app:layout_anchorGravity="bottom|end" android:layout_marginRight="16dp" android:layout_marginEnd="23dp" android:layout_alignBottom="@+id/imageView8" android:layout_alignParentEnd="true" android:layout_marginBottom="29dp" /> <android.support.v7.widget.Toolbar android:id="@+id/toolbar" android:layout_width="match_parent" android:layout_height="?actionBarSize" app:layout_collapseMode="pin" /> </RelativeLayout> </android.support.design.widget.CollapsingToolbarLayout>
Also, according to Google Material Design , I donβt think if this is the standard way / or a good way for two buttons
Also, this is my idea (standard way):
You can add a Share action with this icon on the Actionbar , and then use a single FloatingActionButton as follows:
https://github.com/xuyisheng/DesignSupportLibraryDemo
Or I did it myself:
<android.support.design.widget.CoordinatorLayout xmlns:android="http://schemas.android.com/apk/res/android" xmlns:app="http://schemas.android.com/apk/res-auto" xmlns:card_view="http://schemas.android.com/tools" android:layout_width="match_parent" android:layout_height="match_parent" android:background="#EEEEEE" android:fitsSystemWindows="true"> <android.support.v4.widget.NestedScrollView android:id="@+id/scroll" android:layout_width="match_parent" android:layout_height="match_parent" android:clipToPadding="false" app:layout_behavior="@string/appbar_scrolling_view_behavior"> </android.support.v4.widget.NestedScrollView> <android.support.design.widget.AppBarLayout android:id="@+id/app_bar_layoutdetails" android:layout_width="match_parent" android:layout_height="wrap_content" android:fitsSystemWindows="true" android:theme="@style/ThemeOverlay.AppCompat.Dark.ActionBar"> <android.support.design.widget.CollapsingToolbarLayout android:id="@+id/collapsing_toolbar" android:layout_width="match_parent" android:layout_height="match_parent" android:fitsSystemWindows="true" app:contentScrim="?attr/colorPrimary" app:expandedTitleMarginEnd="64dp" app:expandedTitleMarginStart="48dp" app:layout_scrollFlags="scroll|exitUntilCollapsed"> <RelativeLayout android:layout_width="match_parent" android:layout_height="match_parent"> <ImageView android:id="@+id/thumbnaildetails" android:layout_width="match_parent" android:layout_height="200dp" android:layout_alignParentStart="true" android:contentDescription="@string/imghd" android:fitsSystemWindows="true" android:scaleType="centerCrop" app:layout_collapseMode="parallax" /> <TextView android:id="@+id/txtitemdetailstitle" android:layout_width="wrap_content" android:layout_height="wrap_content" android:layout_alignParentTop="true" android:layout_centerHorizontal="true" android:layout_marginTop="85dp" android:textAppearance="?android:attr/textAppearanceMedium" /> </RelativeLayout> <android.support.v7.widget.Toolbar android:id="@+id/tbbardetails" android:layout_width="match_parent" android:layout_height="?attr/actionBarSize" android:layout_alignParentStart="true" android:layout_alignParentTop="true" app:layout_collapseMode="pin" app:theme="@style/ThemeOverlay.AppCompat.Dark.ActionBar" /> </android.support.design.widget.CollapsingToolbarLayout> </android.support.design.widget.AppBarLayout> <android.support.design.widget.FloatingActionButton android:id="@+id/fab" android:layout_width="wrap_content" android:layout_height="wrap_content" android:layout_margin="16dp" android:src="@drawable/ic_work" app:backgroundTint="#E91E63" app:fabSize="normal" app:layout_anchor="@id/app_bar_layoutdetails" app:layout_anchorGravity="right|bottom" /> </android.support.design.widget.CoordinatorLayout>
source share