code: private void inflateTitleView() {
          titleContainer = rootView.findViewById(R.id.title_container);
          titleContainer.removeAllViews();
  
          if (customTitleView != null) {
              titleContainer.addView(customTitleView);
          } else if (customTitleViewId != -1) {
              LayoutInflater layoutInflater = LayoutInflater.from(getContext());
              View view = layoutInflater.inflate(customTitleViewId, titleContainer, false);
              titleContainer.addView(view);
          } else {
              LayoutInflater layoutInflater = LayoutInflater.from(getContext());
              View view = layoutInflater.inflate(R.layout.bottom_sheet_title, titleContainer, false);
              titleContainer.addView(view);
          }
  
          if (getStyle() == Style.LIST) {
              int padding = getContext().getResources()
                      .getDimensionPixelSize(R.dimen.bottom_sheet_list_item_horizontal_padding);
              titleContainer.setPadding(padding, 0, padding, 0);
          } else {
              int padding = getContext().getResources()
                      .getDimensionPixelSize(R.dimen.bottom_sheet_grid_item_horizontal_padding);
              titleContainer.setPadding(padding, 0, padding, 0);
          }
  
          View titleView = titleContainer.findViewById(android.R.id.title);
          titleTextView = titleView instanceof TextView ? (TextView) titleView : null;
      }
docs: Inflates the layout, which is used to show the bottom sheet's title. The layout may either be
  the default one or a custom view, if one has been set before.