我正在尝试实现新的 BottomSheetDialog,但是当我调用 .show()
时,它显示背景阴影而不是我的布局。
这是我的代码
<?xml version="1.0" encoding="utf-8"?>
<android.support.v4.widget.NestedScrollView
xmlns:android="http://schemas.android.com/apk/res/android"
android:layout_width="match_parent"
android:layout_height="wrap_content">
<RelativeLayout
android:layout_width="match_parent"
android:layout_height="wrap_content"
android:background="@color/white">
<RelativeLayout
android:layout_width="match_parent"
android:layout_height="wrap_content"
android:paddingTop="4dp"
android:paddingBottom="4dp"
android:paddingStart="8dp"
android:paddingEnd="8dp">
<TextView
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:text="Notes"
android:layout_alignParentStart="true"
android:layout_centerVertical="true"
android:textColor="@android:color/black"/>
<Switch
android:id="@+id/notes"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:layout_centerVertical="true"
android:layout_alignParentEnd="true"/>
</RelativeLayout>
</RelativeLayout>
</android.support.v4.widget.NestedScrollView>
然后:
mSettingsDialog = new BottomSheetDialog(this);
View v = getLayoutInflater().inflate(R.layout.reader_settings, null);
mSettingsDialog.setContentView(v);
mSettingsDialog.show();
我该如何解决这个问题?
最佳答案
我遇到了这个问题,我的原因是
dialog XML 名称与其他模块 XML 文件名称相同,因此请尝试将其重命名为另一个
查看布局文件,可能有错误,保持最简单的布局测试。
关于android - BottomSheetDialog 没有显示?,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/36722879/