How to set max width for BottomSheetDialogFragment
<p><strong>Question</strong></p>

<p>I'm using the <code>BottomSheetDialogFragment</code> for my modal bottom sheet and would like to set a maximum width so that on tablets/large screens the <code>BottomSheet</code> doesn't occupy the entire width of the screen. How do I approach solving this? Thanks!</p>

<p><strong>Relevant code &amp; resources</strong></p>

<p><em>fragment_bottomsheet.xml</em>:</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"
    style="@style/BottomSheetStyle"&gt;

    &lt;GridLayout
        android:id="@+id/bottom_sheet"
        android:layout_width="match_parent"
        android:layout_height="wrap_content"
        android:alignmentMode="alignBounds"
        android:columnOrderPreserved="false"
        android:columnCount="3"
        android:paddingTop="16dp"
        android:paddingBottom="8dp"
        android:paddingRight="8dp"
        android:paddingLeft="8dp"
        app:layout_behavior="android.support.design.widget.BottomSheetBehavior"&gt;

        &lt;TextView
            android:layout_width="wrap_content"
            android:layout_height="wrap_content"
            android:drawableTop="@drawable/image1"
            android:text="Open"/&gt;

        &lt;TextView
            android:layout_width="wrap_content"
            android:layout_height="wrap_content"
            android:drawableTop="@drawable/image2"
            android:text="Save"/&gt;

        &lt;TextView
            android:layout_width="wrap_content"
            android:layout_height="wrap_content"
            android:drawableTop="@drawable/image3"
            android:text="Send"/&gt;

        &lt;TextView
            android:layout_width="wrap_content"
            android:layout_height="wrap_content"
            android:drawableTop="@drawable/image4"
            android:text="Upload"/&gt;

        &lt;TextView
            android:layout_width="wrap_content"
            android:layout_height="wrap_content"
            android:drawableTop="@drawable/image5"
            android:text="Share"/&gt;

        &lt;TextView
            android:layout_width="wrap_content"
            android:layout_height="wrap_content"
            android:drawableTop="@drawable/iamge6"
            android:text="More"/&gt;

    &lt;/GridLayout&gt;

&lt;/android.support.design.widget.CoordinatorLayout&gt;
</code></pre>

<p><em>res/values/styles.xml</em>:</p>

<pre><code>&lt;style name="BottomSheetStyle"&gt;
    &lt;item name="android:layout_height"&gt;match_parent&lt;/item&gt;
    &lt;item name="android:layout_width"&gt;match_parent&lt;/item&gt;
    &lt;item name="android:layout_gravity"&gt;center_horizontal&lt;/item&gt;
&lt;/style&gt;
</code></pre>

<p><em>res/values-w600dp/styles.xml</em>:</p>

<pre><code>&lt;style name="BottomSheetStyle"&gt;
    &lt;item name="android:layout_height"&gt;match_parent&lt;/item&gt;
    &lt;item name="android:layout_width"&gt;640dp&lt;/item&gt;
    &lt;item name="android:layout_gravity"&gt;center_horizontal&lt;/item&gt;
&lt;/style&gt;
</code></pre>