BottomSheetDialog - 如何显示所有内容

时间:2018-02-14 13:40:09

标签: android android-support-library bottom-sheet

我正在使用BottomSheetDialog来显示选项列表。我遇到的问题是最初隐藏了一些项目(用户必须向上滑动才能显示所有内容)。如何强制BottomSheetDialog显示所有内容?

我扩展了BottomSheetDialog并使用“setContent”来设置底层对话框的布局:

<?xml version="1.0" encoding="utf-8"?>
<LinearLayout
    xmlns:android="http://schemas.android.com/apk/res/android"
    xmlns:app="http://schemas.android.com/apk/res-auto"
    xmlns:tools="http://schemas.android.com/tools"
    android:layout_width="match_parent"
    android:layout_height="match_parent"
    android:orientation="vertical">

    <TextView
        android:id="@+id/dialog_title"
        android:layout_width="match_parent"
        android:layout_height="40dp"
        android:layout_marginEnd="8dp"
        android:layout_marginStart="16dp"
        android:layout_marginTop="8dp"
        android:textSize="@dimen/dialog_title_text_size"
        android:gravity="center_vertical"
        app:layout_constraintEnd_toEndOf="parent"
        app:layout_constraintStart_toStartOf="parent"
        app:layout_constraintTop_toTopOf="parent"
        tools:text="Title"
        tools:textColor="@color/blue" />

    <ListView
        android:id="@+id/attachment_picker"
        android:layout_width="match_parent"
        android:layout_height="match_parent"
        android:divider="@null"
        tools:listitem="@layout/item_attachment_picker" />
</LinearLayout>

0 个答案:

没有答案
相关问题