I'm trying to implement the new BottomSheetDialog, but when I call .show()
it display the background shadows but not my layout.
This is my code
<?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>
And then:
mSettingsDialog = new BottomSheetDialog(this);
View v = getLayoutInflater().inflate(R.layout.reader_settings, null);
mSettingsDialog.setContentView(v);
mSettingsDialog.show();
How can I fix this issue?
I got this problem, the reason for me is
the dialog XML name is same with other module XML file name, so try rename it to another one
check the layout file, maybe it has some error, keep the simplest layout test it.
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With