Avoid FAB appear above CoordinatorLayout
Avoid FAB appear above CoordinatorLayout
I'm trying to put an image on the top of CoordinatorLayout, so it will be half top of the view. it's work fine (attached pic), but when the coordinatorLayout is open to top - the image is get into the coordinatorLayout.
any idea how can i avoid this and keep the image on the top.
i want the image will get into the background zone.
<?xml version="1.0" encoding="utf-8"?>
<android.support.constraint.ConstraintLayout
android:layout_width="match_parent"
android:layout_height="match_parent">
<RelativeLayout
android:layout_width="match_parent"
android:layout_height="match_parent"
android:orientation="vertical">
<LinearLayout
android:id="@+id/backgroundLayout"
android:layout_width="match_parent"
android:layout_height="50dp"
android:background="@color/TRY3"
android:orientation="vertical"></LinearLayout>
<android.support.design.widget.CoordinatorLayout
android:id="@+id/coordinateMainLayout"
android:layout_width="match_parent"
android:layout_height="match_parent"
android:paddingTop="50dp">
<android.support.design.widget.AppBarLayout
android:id="@+id/appbar"
android:layout_width="match_parent"
android:layout_height="wrap_content"
android:background="@color/TRY3"
android:fitsSystemWindows="true"
android:theme="@style/ThemeOverlay.AppCompat.Dark.ActionBar">
<android.support.design.widget.CollapsingToolbarLayout
android:id="@+id/collapsingToolBar"
android:layout_width="match_parent"
android:layout_height="wrap_content"
android:fitsSystemWindows="true"
app:expandedTitleTextAppearance="@android:color/transparent"
app:layout_scrollFlags="scroll|exitUntilCollapsed">
</android.support.design.widget.CollapsingToolbarLayout>
</android.support.design.widget.AppBarLayout>
<android.support.v4.widget.NestedScrollView
android:id="@+id/innerScrollView"
android:layout_width="match_parent"
android:layout_height="wrap_content"
android:clipToPadding="false"
app:layout_behavior="@string/appbar_scrolling_view_behavior">
<RelativeLayout
android:id="@+id/mainLayout"
android:layout_width="match_parent"
android:layout_height="wrap_content"
android:background="@color/B1"
android:orientation="vertical">
<FrameLayout
android:id="@+id/whiteLayout"
android:layout_width="match_parent"
android:layout_height="wrap_content"
android:background="@color/B1">
</FrameLayout>
</RelativeLayout>
</android.support.v4.widget.NestedScrollView>
<android.support.design.widget.FloatingActionButton
android:id="@+id/floatingActionButton"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:layout_marginBottom="70dp"
android:layout_marginLeft="50dp"
android:scaleType="center"
android:src="@drawable/white_plus"
app:backgroundTint="@color/T103"
app:fabSize="normal"
app:layout_anchor="@id/innerScrollView" />
</android.support.design.widget.CoordinatorLayout>
</RelativeLayout>
</android.support.constraint.ConstraintLayout>
a

Thanks, but still look the same. the image is look great until i'm scroll all the way up.
– Bruse
Jul 2 at 4:53
By clicking "Post Your Answer", you acknowledge that you have read our updated terms of service, privacy policy and cookie policy, and that your continued use of the website is subject to these policies.
Add layout_anchor_gravity = "center|top|start". Although you've anchored your FAB to the scroll view, you haven't set it's gravity. So it'll be just at the top left corner. (Sorry for formatting, am on mobile)
– Yashovardhan
Jul 1 at 16:28