我有一个BottomSheetDialogFragment
用户可以在其中购买东西的地方。为了使用主卡/签证卡付款,用户被发送到浏览器以进行安全的支付交易。
当我再次返回应用程序时,一切都很好。但是如果我关闭底部的工作表对话框并再次打开它,内容会突然被推到屏幕下方,如下面的 Layout Inspector 图像所示。所以用户不再看到内容,他只看到标准的暗影,它总是显示在对话框后面。
如果我关闭/打开所有步骤的对话框,除了在浏览器往返后关闭/打开它时,一切正常。
底部表格突然变得很大(从正常情况下的〜500px到有车情况下的〜1500px)。但我不知道为什么。
根据我的调查,我确定活动以某种方式发生了变化。主题标志或类似的标志会在下次更改并弄乱底页。
非常感谢您对此的任何想法。
这是底部工作表 xml 的简化版本
<?xml version="1.0" encoding="utf-8"?>
<androidx.constraintlayout.widget.ConstraintLayout
android:id="@+id/bottomSheetRoot"
android:layout_width="match_parent"
android:layout_height="wrap_content"
android:layout_gravity="bottom"
app:behavior_hideable="true"
app:layout_behavior="com.google.android.material.bottomsheet.BottomSheetBehavior">
<androidx.appcompat.widget.AppCompatImageView
android:id="@+id/handle"
android:layout_width="match_parent"
android:layout_height="wrap_content"
app:layout_constraintTop_toTopOf="parent" />
<com.telia.commonUI.views.Toolbar
android:id="@+id/toolbar"
android:layout_width="match_parent"
android:layout_height="wrap_content"
app:layout_constraintTop_toBottomOf="@id/handle"/>
<androidx.core.widget.NestedScrollView
android:id="@+id/nestedScroll"
android:layout_width="match_parent"
android:layout_height="wrap_content"
app:layout_constraintTop_toBottomOf="@id/toolbar"
app:layout_constraintBottom_toBottomOf="parent">
<androidx.fragment.app.FragmentContainerView
android:id="@+id/fragmentContainer"
android:name="androidx.navigation.fragment.NavHostFragment"
android:layout_width="match_parent"
android:layout_height="wrap_content" />
</androidx.core.widget.NestedScrollView>
</androidx.constraintlayout.widget.ConstraintLayout>