Q: Fragment layout inside my layout moves up and down when visibility on other view is toggled I am facing an issue where in fragment inside my layout moves up and down, (Looks like flickering) when i set the visibility of other views (for ex. view with id as category_collapsed) in the same layout. This is my xml. 
How do i solve this issue? I have tried by setting animateLayoutChanges as false in the parent layout. Still it is not working.
<?xml version="1.0" encoding="utf-8"?>
<layout xmlns:android="http://schemas.android.com/apk/res/android"
xmlns:app="http://schemas.android.com/apk/res-auto">

<data>
<import type="android.view.View" />

<variable
  name="viewmodel"
  type="com.sample.viewmodel.BaseViewModel" />

 </data>

<androidx.coordinatorlayout.widget.CoordinatorLayout
android:layout_width="match_parent"
android:layout_height="match_parent"
android:animateLayoutChanges="false"
android:background="@color/colorDarkBackgroundShade">

<fragment
  android:id="@+id/map"
  class="com.google.android.gms.maps.SupportMapFragment"
  android:layout_width="match_parent"
  android:layout_height="fill_parent" />


<RelativeLayout
  android:layout_width="match_parent"
  android:layout_height="match_parent"
  android:animateLayoutChanges="false">


  <FrameLayout
    android:id="@+id/category_collapsed"
    android:layout_width="48dp"
    android:layout_height="48dp"
    android:layout_alignParentEnd="true"
    android:layout_centerVertical="true"
    android:layout_marginStart="@dimen/standard_spacing"
    android:layout_marginTop="@dimen/standard_spacing"
    android:alpha="0.9"
    android:background="@drawable/common_round_red_secondary"
    android:onClick="@{() -> viewmodel.showPanicCategoryLayout()}">

    <ImageView
      android:layout_width="wrap_content"
      android:layout_height="wrap_content"
      android:layout_gravity="center"
      android:src="@drawable/ic_common_fire"
      android:tint="@color/white" />

  </FrameLayout>

   </RelativeLayout>

  </androidx.coordinatorlayout.widget.CoordinatorLayout>
</layout>

This is how i am using visibility modifier.
if (isShowCategory) {
            binding.categoryCollapsed.visibility = View.GONE
            binding.categoryExpanded.visibility = View.VISIBLE
        } else {
            binding.categoryExpanded.visibility = View.GONE
            binding.categoryCollapsed.visibility = View.VISIBLE
        }


