title: Static Footer View On Android Bottom Sheet
body: <p>I am trying to make a <strong>static footer</strong> on a bottomsheet on Android. Below is a GIF of my current attempt. Notice the <code>footer</code> text at the bottom of the sheet when it is fully expanded. I want this footer text to <strong>always</strong> show regardless of what state the sheet is in. (e.g. if the sheet is only half expanded, the footer should still show. As the sheet is being expanded/collapsed, the footer should still always show etc.) How can I accomplish this behavior? I have had a look at this: <a href="https://github.com/umano/AndroidSlidingUpPanel" rel="noreferrer">https://github.com/umano/AndroidSlidingUpPanel</a> but I would prefer to get a vanilla android solution that does not involve any external libraries. </p>
  
  <p><a href="https://i.stack.imgur.com/f1pEn.gif" rel="noreferrer"><img src="https://i.stack.imgur.com/f1pEn.gif" alt="enter image description here"></a></p>
  
  <p>Here is my current XML. I think the problem is the footer is anchored to the bottom of the view, but the bottom of the view is only visible if the sheet is fully expanded. I want to see if I can get the footer to show regardless of the state of the sheet:</p>
  
  <pre><code>&lt;?xml version="1.0" encoding="utf-8"?&gt;
  &lt;androidx.coordinatorlayout.widget.CoordinatorLayout
      xmlns:airbnb="http://schemas.android.com/apk/res-auto"
      xmlns:android="http://schemas.android.com/apk/res/android"
      android:layout_width="match_parent"
      android:layout_height="wrap_content"&gt;
      &lt;RelativeLayout
          android:layout_width="match_parent"
          android:layout_height="match_parent"
          android:focusableInTouchMode="true"
          android:orientation="vertical"
          android:id="@+id/linear_layout_container"&gt;
  
          &lt;TextView
              android:id="@+id/header_text"
              android:layout_width="match_parent"
              android:text="Header"
              android:layout_height="36dp"
              android:layout_alignParentTop="true"
              /&gt;
  
          &lt;com.airbnb.epoxy.EpoxyRecyclerView
              android:id="@+id/bottom_sheet_recycler_view"
              android:layout_width="match_parent"
              android:layout_height="wrap_content"
              airbnb:layoutManager="LinearLayoutManager"
              android:layout_above="@+id/footer_text"
              android:layout_below="@+id/header_text"
              /&gt;
          &lt;TextView
              android:id="@+id/footer_text"
              android:layout_width="match_parent"
              android:text="Footer"
              android:layout_height="36dp"
              android:layout_alignParentBottom="true"
              airbnb:layout_anchorGravity="bottom"
              /&gt;
      &lt;/RelativeLayout&gt;
  &lt;/androidx.coordinatorlayout.widget.CoordinatorLayout&gt;
  </code></pre>
  
  <p>Here is what my fragment looks like. It is just a blank fragment that shows a bottom sheet:
  <code>ContainerFragment.kt</code></p>
  
  <pre><code>
  import android.os.Bundle
  import android.view.LayoutInflater
  import android.view.View
  import android.view.ViewGroup
  import androidx.fragment.app.Fragment
  import androidx.recyclerview.widget.LinearLayoutManager
  import com.airbnb.epoxy.EpoxyRecyclerView
  import com.google.android.material.bottomsheet.BottomSheetDialog
  
  class ContainerFragment : Fragment() {
  
  
      override fun onCreateView(
          inflater: LayoutInflater, container: ViewGroup?,
          savedInstanceState: Bundle?
      ): View? {
          // Inflate the layout for this fragment
          return inflater.inflate(R.layout.container_fragment_layout, container, false)
      }
  
      override fun onViewCreated(view: View, savedInstanceState: Bundle?) {
          super.onViewCreated(view, savedInstanceState)
          view.alpha = 0f
          val bottomSheet = BottomSheetDialog(requireContext())
          val bottomSheetView = LayoutInflater.from(context).inflate(R.layout.test_bottom_sheet_layout, null)
          bottomSheet.setContentView(bottomSheetView)
          bottomSheet.show()
          val epoxyRecyclerView : EpoxyRecyclerView = bottomSheetView.findViewById(R.id.bottom_sheet_recycler_view)
          epoxyRecyclerView.layoutManager = LinearLayoutManager(context, LinearLayoutManager.VERTICAL, false)
          epoxyRecyclerView.withModels {
              (0..100).forEach {
                  basicRow {
                      id(it)
                      title("This is the entry at index $it.")
                  }
              }
          }
      }
      companion object {
          fun newInstance() = ContainerFragment()
      }
  }
  </code></pre>
  
  <p>Here is my fragment layout:
  <code>container_fragment_layout.xml</code>:</p>
  
  <pre><code>&lt;?xml version="1.0" encoding="utf-8"?&gt;
  &lt;LinearLayout xmlns:android="http://schemas.android.com/apk/res/android" android:orientation="vertical" android:layout_width="match_parent"
      android:layout_height="match_parent"&gt;
  
  &lt;/LinearLayout&gt;
  </code></pre>