Я испытываю странное поведение в своем диалоговом окне, когда меняю заполнение ConstraintLayout. Вот xml:
<?xml version="1.0" encoding="utf-8"?>
<layout xmlns:android="http://schemas.android.com/apk/res/android"
xmlns:app="http://schemas.android.com/apk/res-auto">
<data>
<variable
name="viewModel"
type="ie.conecto.ui.salesOrder.viewModels.OrderSummaryViewModel" />
</data>
<androidx.constraintlayout.widget.ConstraintLayout
android:id="@+id/root_place_order_confirmation"
android:layout_width="match_parent"
android:layout_height="match_parent"
android:padding="4dp">
<TextView
android:id="@+id/place_order_confirmation_dialog_header"
style="@style/TextAppearance.MaterialComponents.Headline5"
android:layout_width="0dp"
android:layout_height="wrap_content"
android:background="@color/colorPrimary"
android:padding="8dp"
android:text="@{viewModel.dialogHeader}"
android:textAlignment="center"
android:textColor="@android:color/white"
app:layout_constraintEnd_toEndOf="parent"
app:layout_constraintStart_toStartOf="parent"
app:layout_constraintTop_toTopOf="parent" />
<ScrollView
android:id="@+id/scrollView3"
android:layout_width="0dp"
android:layout_height="wrap_content"
android:paddingTop="72dp"
android:paddingBottom="72dp"
app:layout_constraintBottom_toTopOf="@+id/relativeLayout"
app:layout_constraintEnd_toEndOf="parent"
app:layout_constraintStart_toStartOf="parent"
app:layout_constraintTop_toBottomOf="@+id/place_order_confirmation_dialog_header">
<!-- tools:layout_editor_absoluteX="2dp">-->
<LinearLayout
android:id="@+id/order_details_container"
android:layout_width="match_parent"
android:layout_height="wrap_content"
android:gravity="center_horizontal"
android:orientation="vertical"
android:paddingBottom="4dp">
<TextView
style="@style/TextAppearance.MaterialComponents.Caption"
android:layout_width="match_parent"
android:layout_height="wrap_content"
android:hint="@string/customer"
android:paddingStart="4dp"
android:paddingEnd="4dp"
android:text="@{viewModel.customer.code}" />
<TextView
style="@style/TextAppearance.MaterialComponents.Body1"
android:layout_width="match_parent"
android:layout_height="wrap_content"
android:layout_marginBottom="4dp"
android:hint="@string/customer"
android:paddingStart="4dp"
android:paddingEnd="4dp"
android:text="@{viewModel.customer.description}" />
<include layout="@layout/divider" />
<androidx.recyclerview.widget.RecyclerView
android:id="@+id/salesOrderConfirmationProductsRecyclerView"
android:layout_width="match_parent"
android:layout_height="wrap_content"
android:layout_marginTop="4dp"
android:layout_marginBottom="4dp"
android:clickable="false"
android:focusable="false"
android:paddingStart="4dp"
android:paddingEnd="4dp"
app:adapter="@{viewModel.orderConfirmationProductsAdapter}"
app:layoutManager="LinearLayoutManager">
</androidx.recyclerview.widget.RecyclerView>
<include layout="@layout/divider" />
<LinearLayout
android:layout_width="match_parent"
android:layout_height="wrap_content"
android:layout_marginTop="4dp"
android:layout_marginBottom="4dp"
android:orientation="horizontal"
android:paddingStart="8dp"
android:paddingEnd="8dp">
<TextView
android:id="@+id/prodCountLabel"
android:layout_width="0dp"
android:layout_height="wrap_content"
android:layout_weight="1"
android:text="@string/product_count" />
<TextView
android:id="@+id/prodCount"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
app:text="@{viewModel.productCount}" />
</LinearLayout>
....
....
....
....
</LinearLayout>
</ScrollView>
<RelativeLayout
android:id="@+id/relativeLayout"
android:layout_width="match_parent"
android:layout_height="wrap_content"
android:layout_marginStart="4dp"
android:layout_marginEnd="4dp"
android:orientation="horizontal"
app:layout_constraintBottom_toBottomOf="parent"
app:layout_constraintEnd_toEndOf="parent"
app:layout_constraintStart_toStartOf="parent">
<com.google.android.material.button.MaterialButton
android:id="@+id/buttCancelPlaceOrder"
style="@style/Widget.MaterialComponents.Button.TextButton"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:layout_toStartOf="@id/buttOk"
android:text="@string/butt_cancel" />
<com.google.android.material.button.MaterialButton
android:id="@+id/buttOk"
style="@style/Widget.MaterialComponents.Button.TextButton"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:layout_alignParentEnd="true"
android:text="@string/butt_ok" />
</RelativeLayout>
</androidx.constraintlayout.widget.ConstraintLayout>
</layout>
, это дает мне следующий диалог:
Однако, если я изменяю отступ в макете ограничения на 2dp:
<androidx.constraintlayout.widget.ConstraintLayout
android:id="@+id/root_place_order_confirmation"
android:layout_width="match_parent"
android:layout_height="match_parent"
android:padding="2dp">
, я получаю этот диалог:
Я бы предпочел, чтобы отступ составлял 2dp, но что-либо ниже 4dp сворачивало диалоговое окно. Есть идеи, почему это происходит?