如何在xml中设置模式底部工作表的宽度?

如何在xml中设置模式底部工作表的宽度?,xml,android-studio,kotlin,material-design,Xml,Android Studio,Kotlin,Material Design,我试图使底部纸张的宽度仅包装内容并显示在屏幕的右下角。我使用安卓平板电脑作为设备。我在底部的板材设计网站上搜索了实现和任何可以控制宽度的xml属性。我试图设置宽度来包装内容,但没有成功 这是我想要的尺码: 只要使用一个我已经处理过的通过“模态底部表单”制作此类材料组件的所有案例,你的意思是你正在使用一个底部表单对话框[片段]?对,但是“模态”有一个特定的含义,它与实现无关。我在问你用什么来实现这个,忘掉模态部分吧。我只是问你到底用什么做底片。您是否正在使用底部表单对话框[片段]?或者这是一个

我试图使底部纸张的宽度仅包装内容并显示在屏幕的右下角。我使用安卓平板电脑作为设备。我在底部的板材设计网站上搜索了实现和任何可以控制宽度的xml属性。我试图设置宽度来包装内容,但没有成功

这是我想要的尺码:



只要使用一个我已经处理过的通过“模态底部表单”制作此类材料组件的所有案例,你的意思是你正在使用一个
底部表单对话框[片段]
?对,但是“模态”有一个特定的含义,它与实现无关。我在问你用什么来实现这个,忘掉模态部分吧。我只是问你到底用什么做底片。您是否正在使用
底部表单对话框[片段]
?或者这是一个
视图
协调布局
中,具有
底部行为
?还有别的吗?当然可以。但是,如果您这样做,您必须自己处理模态行为,因为它只是
协调器布局中的另一个
视图。通过
对话框
,它本质上是模态的。仅供参考。干杯是的,谢谢你提供的信息!几个月前,我以同样的方式创建了一个底部的表单片段。我忘了把它放在协调器布局中。
<?xml version="1.0" encoding="utf-8"?>
<androidx.constraintlayout.widget.ConstraintLayout xmlns:android="http://schemas.android.com/apk/res/android"
    android:id="@+id/bottom_sheet_layout"
    android:layout_width="wrap_content"
    android:layout_height="wrap_content"
    android:layout_gravity="end"
    xmlns:app="http://schemas.android.com/apk/res-auto">

    <com.google.android.material.textview.MaterialTextView
        android:id="@+id/bottom_sheet_text"
        android:layout_width="wrap_content"
        android:layout_height="wrap_content"
        android:text="This is a bottom sheet"
        app:layout_constraintTop_toTopOf="parent"
        app:layout_constraintBottom_toBottomOf="parent"
        app:layout_constraintEnd_toEndOf="parent"
        app:layout_constraintStart_toStartOf="parent"/>

    <com.google.android.material.button.MaterialButton
        android:id="@+id/bottom_sheet_btn1"
        android:layout_width="wrap_content"
        android:layout_height="wrap_content"
        app:layout_constraintTop_toBottomOf="@id/bottom_sheet_text"
        app:layout_constraintStart_toStartOf="parent"
        app:layout_constraintEnd_toEndOf="parent"
        />

    <com.google.android.material.button.MaterialButton
        android:id="@+id/bottom_sheet_btn2"
        android:layout_width="wrap_content"
        android:layout_height="wrap_content"
        app:layout_constraintTop_toBottomOf="@id/bottom_sheet_btn1"
        app:layout_constraintStart_toStartOf="parent"
        app:layout_constraintEnd_toEndOf="parent"
        />

</androidx.constraintlayout.widget.ConstraintLayout>