title: BotomSheetDialog FabButton Anchor View not working as expected
body: <p>Hi I am trying to anchor Fab button to BottomSheetDialog but it is not working.
  <strong>EDITED</strong>
  Here is My Dialog</p>
  
  <pre><code>public static class QuickInfoDialog extends BottomSheetDialogFragment {
  
          private BottomSheetBehavior.BottomSheetCallback mBottomSheetBehaviorCallback = new BottomSheetBehavior.BottomSheetCallback() {
  
              @Override
              public void onStateChanged(@NonNull View bottomSheet, int newState) {
                  if (newState == BottomSheetBehavior.STATE_HIDDEN) {
                      dismiss();
                  }
  
              }
  
              @Override
              public void onSlide(@NonNull View bottomSheet, float slideOffset) {
              }
          };
  
  
          @Override
          public void onStart() {
              super.onStart();
  
              // Less dimmed background; see https://stackoverflow.com/q/13822842/56285
              Window window = getDialog().getWindow();
              WindowManager.LayoutParams params = window.getAttributes();
              params.dimAmount = 0.0f; // dim only a little bit
              window.setAttributes(params);
  
              // Transparent background; see https://stackoverflow.com/q/15007272/56285
              // (Needed to make dialog's alpha shadow look good)
              window.setBackgroundDrawableResource(android.R.color.transparent);
          }
  
  
          @Override
          public void setupDialog(Dialog dialog, int style) {
              super.setupDialog(dialog, style);
              View contentView = View.inflate(getContext(), R.layout.location_info_sheet, null);
              dialog.requestWindowFeature(Window.FEATURE_NO_TITLE);
              dialog.getWindow().setBackgroundDrawableResource(android.R.color.transparent);
  
              dialog.setContentView(contentView);
  
              CoordinatorLayout.LayoutParams params = (CoordinatorLayout.LayoutParams) ((View) contentView.getParent()).getLayoutParams();
              CoordinatorLayout.Behavior behavior = params.getBehavior();
  
              if (behavior != null &amp;&amp; behavior instanceof BottomSheetBehavior) {
                  ((BottomSheetBehavior) behavior).setBottomSheetCallback(mBottomSheetBehaviorCallback);
              }
  
  //            FloatingActionButton navBtn = (FloatingActionButton) dialog.findViewById(R.id.btn_fab_direction);
  //            FrameLayout.LayoutParams layoutParams = (FrameLayout.LayoutParams) navBtn.getLayoutParams();
  //            int boundary = (int) (layoutParams.topMargin + (layoutParams.width * 0.5));
  //            layoutParams.topMargin = boundary;
  //            LogUtils.LOGD(TAG, "boundary:  " + boundary);
  //            navBtn.setLayoutParams(layoutParams);
          }
  
          @Override
          public void onViewCreated(View view, @Nullable Bundle savedInstanceState) {
              super.onViewCreated(view, savedInstanceState);
  
          }
      }
  </code></pre>
  
  <p>This is my xml where my other layouts and fab button is defined.</p>
  
  <pre><code>&lt;?xml version="1.0" encoding="utf-8"?&gt;
  &lt;LinearLayout 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:id="@+id/location_bottom_sheet"
      android:layout_width="match_parent"
      android:layout_height="196dp"
      android:background="@android:color/transparent"
      android:gravity="bottom"
      android:orientation="vertical"
      app:behavior_hideable="true"
      app:behavior_peekHeight="0dp"
      app:layout_behavior="@string/bottom_sheet_behavior"
      tools:ignore="MissingPrefix"&gt;
  
      &lt;FrameLayout
          android:layout_width="match_parent"
          android:layout_height="wrap_content"
          android:background="@android:color/transparent"&gt;
  
  
          &lt;FrameLayout
              android:id="@+id/clickable_sheet_layout"
              android:layout_width="match_parent"
              android:layout_height="wrap_content"
              android:layout_marginTop="48dp"
              android:clickable="true"&gt;
  
              &lt;LinearLayout
                  android:layout_width="match_parent"
                  android:layout_height="match_parent"
                  android:background="@color/white"
                  android:orientation="horizontal"&gt;
  
                  &lt;LinearLayout
                      android:layout_width="0dp"
                      android:layout_height="match_parent"
                      android:layout_marginBottom="@dimen/eight_dp"
                      android:layout_marginTop="@dimen/eight_dp"
                      android:layout_weight="0.3"
                      android:gravity="center"&gt;
  
                      &lt;ImageView
                          android:id="@+id/image_view"
                          android:layout_width="@dimen/location_info_size"
                          android:layout_height="@dimen/location_info_size"
                          android:padding="@dimen/eight_dp"
                          android:src="@drawable/ic_launcher" /&gt;
                  &lt;/LinearLayout&gt;
  
                  &lt;LinearLayout
                      android:layout_width="0dp"
                      android:layout_height="match_parent"
                      android:layout_marginBottom="@dimen/eight_dp"
                      android:layout_marginTop="@dimen/eight_dp"
                      android:layout_weight="0.7"
                      android:gravity="center"
                      android:orientation="vertical"&gt;
  
                      &lt;TextView
                          android:id="@+id/name_tv"
                          fontPath="@string/font_neue_pro_regular"
                          android:layout_width="match_parent"
                          android:layout_height="wrap_content"
                          android:padding="@dimen/four_dp"
                          android:textColor="@color/semi_black"
                          android:textSize="@dimen/sixteen_sp" /&gt;
  
                      &lt;TextView
                          android:id="@+id/street_tv"
                          fontPath="@string/font_neue_pro_light"
                          android:layout_width="match_parent"
                          android:layout_height="wrap_content"
                          android:padding="@dimen/four_dp"
                          android:textSize="@dimen/fourteen_sp" /&gt;
  
                      &lt;TextView
                          android:id="@+id/address_tv"
                          fontPath="@string/font_neue_pro_light"
                          android:layout_width="match_parent"
                          android:layout_height="wrap_content"
                          android:padding="@dimen/four_dp"
                          android:textSize="@dimen/fourteen_sp" /&gt;
  
                      &lt;TextView
                          android:id="@+id/distance_tv"
                          fontPath="@string/font_neue_pro_light"
                          android:layout_width="match_parent"
                          android:layout_height="wrap_content"
                          android:gravity="center_vertical|left"
                          android:padding="@dimen/four_dp"
                          android:textSize="@dimen/twelve_sp"
                          android:textColor="@color/semi_grey"/&gt;
                  &lt;/LinearLayout&gt;
              &lt;/LinearLayout&gt;
          &lt;/FrameLayout&gt;
  
          &lt;android.support.design.widget.FloatingActionButton
              android:id="@+id/btn_fab_direction"
              android:layout_width="wrap_content"
              android:layout_height="wrap_content"
              android:layout_gravity="right"
              android:src="@drawable/ic_directions_white"
              app:layout_anchor="@id/app_bar_layout"
              app:layout_anchorGravity="bottom|end" /&gt;
  
      &lt;/FrameLayout&gt;
  &lt;/LinearLayout&gt;
  </code></pre>
  
  <p>I have tried solution from here
  <a href="https://stackoverflow.com/questions/35727799/android-bottomsheet-with-floatbutton">Android BottomSheet with FloatButton</a> but it did not work.</p>
  
  <p>Fragment Layout from which i am showing this BottomSheet.</p>
  
  <pre><code>&lt;?xml version="1.0" encoding="utf-8"?&gt;
  &lt;android.support.design.widget.CoordinatorLayout 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:id="@+id/coordinatorLayout"
      android:layout_width="match_parent"
      android:layout_height="match_parent"
      android:fitsSystemWindows="true"
      android:focusable="true"
      android:focusableInTouchMode="true"&gt;
  
      &lt;android.support.design.widget.AppBarLayout
          android:id="@+id/app_bar_layout"
          android:layout_width="match_parent"
          android:layout_height="wrap_content"&gt;
  
  
  
          &lt;View
              android:layout_width="match_parent"
              android:layout_height="1dp"
              android:layout_gravity="bottom"
              android:background="@color/style_color_accent" /&gt;
      &lt;/android.support.design.widget.AppBarLayout&gt;
  
      &lt;FrameLayout
          android:layout_width="match_parent"
          android:layout_height="match_parent"
          android:gravity="center"
          android:orientation="vertical"
          app:layout_behavior="@string/appbar_scrolling_view_behavior"&gt;
  
          &lt;FrameLayout
              android:id="@+id/map_main_fragment"
              android:layout_width="match_parent"
              android:layout_height="match_parent" /&gt;
  
          &lt;RelativeLayout
              android:layout_width="match_parent"
              android:layout_height="wrap_content"
              android:layout_margin="@dimen/sixteen_dp"
              android:focusable="false"
              android:focusableInTouchMode="false"&gt;
  
              &lt;LinearLayout
                  android:id="@+id/layout_search_filter"
                  android:layout_width="match_parent"
                  android:layout_height="48dp"
                  android:orientation="horizontal"&gt;
  
                  &lt;TextView
                      android:id="@+id/search_input_tv"
                      fontPath="@string/font_neue_pro_light"
                      android:layout_width="0dp"
                      android:layout_height="match_parent"
                      android:layout_weight="0.85"
                      android:background="@drawable/bg_shadow_layout"
                      android:elevation="@dimen/eight_dp"
                      android:gravity="center|left"
                      android:hint="@string/search_input_et_hint"
                      android:paddingLeft="@dimen/eight_dp"
                      android:textColor="@color/semi_black"
                      android:textColorHint="@color/semi_grey"
                      android:textSize="@dimen/fourteen_sp" /&gt;
  
                  &lt;ImageView
                      android:id="@+id/location_filter_selector_iv"
                      android:layout_width="0dp"
                      android:layout_height="match_parent"
                      android:layout_marginLeft="@dimen/eight_dp"
                      android:layout_weight="0.15"
                      android:background="@drawable/bg_shadow_layout"
                      android:elevation="@dimen/eight_dp"
                      android:padding="@dimen/twelve_dp"
                      android:src="@drawable/ic_filter_grey" /&gt;
  
              &lt;/LinearLayout&gt;
  
          &lt;/RelativeLayout&gt;
  
      &lt;/FrameLayout&gt;
  
      &lt;include layout="@layout/location_info_sheet" /&gt;
  
  &lt;/android.support.design.widget.CoordinatorLayout&gt;
  </code></pre>