У меня проблема с моим viewPager внутри bottomSheet. Когда я меняю страницу viewPager, bottomSheet закрывается в состоянии Свернутый
Кстати, viewPager находится внутри nestedScrollView
Так что же уловка, чтобы предотвратить это
Я уже пытаюсь это решение: https://medium.com/@hanru.yeh / забавное решение, которое делает нижний листдиалог-поддержка-просмотр-просмотрщик-с-вложенными scrollingchilds-bfdca72235c3
<?xml version="1.0" encoding="utf-8"?>
<FrameLayout 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:clickable="true"
android:focusable="true"
android:layout_gravity="center"
app:behavior_hideable="true"
app:behavior_peekHeight="0dp"
app:layout_behavior="com.acheteza.achetezamodule.view.ViewPagerBehavior">
<LinearLayout
android:orientation="vertical"
android:layout_width="match_parent"
android:layout_height="match_parent"
android:clickable="true"
android:focusable="true"
android:layout_gravity="center">
<LinearLayout
android:id="@+id/bottom_sheet_poi_collapse_layout"
android:layout_width="match_parent"
android:layout_height="wrap_content"
android:orientation="vertical"
android:background="@color/day_or_night_theme_color">
<androidx.constraintlayout.widget.ConstraintLayout
android:layout_width="match_parent"
android:layout_height="match_parent"
android:paddingBottom="8dp">
<androidx.appcompat.widget.AppCompatImageView
android:id="@+id/bottom_sheet_poi_chevron"
android:layout_width="0dp"
android:layout_height="wrap_content"
android:layout_marginTop="8dp"
android:layout_marginStart="16dp"
android:layout_marginEnd="16dp"
android:elevation="0dp"
app:srcCompat="@drawable/ic_expand_less"
android:tint="@color/colorStepperLine"
app:layout_constraintTop_toTopOf="parent"
app:layout_constraintStart_toStartOf="parent"
app:layout_constraintEnd_toEndOf="parent"
tools:targetApi="lollipop"/>
<androidx.appcompat.widget.AppCompatTextView
android:id="@+id/bottom_sheet_poi_name"
android:layout_width="0dp"
android:layout_height="wrap_content"
android:layout_marginTop="8dp"
android:layout_marginStart="16dp"
android:textSize="16sp"
android:textStyle="bold"
android:textColor="@color/colorBlackToWhite"
app:layout_constraintTop_toBottomOf="@+id/bottom_sheet_poi_chevron"
app:layout_constraintStart_toStartOf="parent"
app:layout_constraintEnd_toStartOf="@+id/bottom_sheet_poi_button_close"/>
<androidx.appcompat.widget.AppCompatTextView
android:id="@+id/bottom_sheet_poi_address"
android:layout_width="0dp"
android:layout_height="wrap_content"
app:layout_constraintStart_toStartOf="parent"
android:layout_marginStart="16dp"
android:textSize="12sp"
android:textColor="@color/colorBlackToWhite"
app:layout_constraintTop_toBottomOf="@+id/bottom_sheet_poi_name"
app:layout_constraintEnd_toStartOf="@+id/bottom_sheet_poi_button_close"/>
<LinearLayout
android:id="@+id/bottom_sheet_poi_contact_layout_collapsed"
android:layout_width="0dp"
android:layout_height="wrap_content"
android:orientation="horizontal"
android:gravity="center_horizontal"
android:layout_marginTop="8dp"
android:layout_marginStart="16dp"
android:layout_marginEnd="16dp"
app:layout_constraintStart_toStartOf="parent"
app:layout_constraintEnd_toEndOf="parent"
app:layout_constraintTop_toBottomOf="@+id/bottom_sheet_poi_address">
<androidx.appcompat.widget.AppCompatImageButton
style="@style/MapButtonStyle"
android:theme="@style/MapButtonStyle"
android:id="@+id/bottom_sheet_poi_phone"
android:layout_width="64dp"
android:layout_height="match_parent"
android:scaleType="fitCenter"
app:srcCompat="@drawable/ic_phone"/>
<androidx.appcompat.widget.AppCompatImageButton
style="@style/MapButtonStyle"
android:theme="@style/MapButtonStyle"
android:id="@+id/bottom_sheet_poi_mail"
android:layout_width="64dp"
android:layout_height="match_parent"
android:scaleType="fitCenter"
android:layout_gravity="center_horizontal"
app:srcCompat="@drawable/ic_email"/>
</LinearLayout>
<androidx.appcompat.widget.AppCompatButton
android:id="@+id/bottom_sheet_poi_go"
android:layout_width="0dp"
android:layout_height="wrap_content"
android:layout_marginStart="16dp"
android:layout_marginEnd="16dp"
android:layout_marginTop="8dp"
android:text="@string/move_snackbar_button_go"
android:textAlignment="center"
android:textColor="@color/white"
app:backgroundTint="@color/colorPrimary"
app:layout_constraintStart_toStartOf="parent"
app:layout_constraintEnd_toEndOf="parent"
app:layout_constraintTop_toBottomOf="@+id/bottom_sheet_poi_contact_layout_collapsed"/>
<androidx.appcompat.widget.AppCompatImageButton
android:id="@+id/bottom_sheet_poi_button_close"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:scaleType="fitCenter"
android:layout_marginStart="8dp"
android:layout_marginEnd="16dp"
android:layout_marginTop="8dp"
android:background="@android:color/transparent"
android:foreground="?actionBarItemBackground"
android:tint="@color/colorFilterLight"
app:srcCompat="@drawable/ic_close"
app:layout_constraintEnd_toEndOf="parent"
app:layout_constraintTop_toTopOf="parent"/>
</androidx.constraintlayout.widget.ConstraintLayout>
</LinearLayout>
<androidx.core.widget.NestedScrollView
android:layout_width="match_parent"
android:layout_height="match_parent"
android:background="@color/day_or_night_theme_color">
<androidx.constraintlayout.widget.ConstraintLayout
android:layout_width="match_parent"
android:layout_height="wrap_content"
android:layout_marginTop="8dp">
<androidx.cardview.widget.CardView
android:id="@+id/bottom_sheet_poi_thumbnail_card"
android:layout_width="0dp"
android:layout_height="wrap_content"
android:layout_marginStart="16dp"
android:layout_marginEnd="16dp"
app:cardCornerRadius="8dp"
app:layout_constraintStart_toStartOf="parent"
app:layout_constraintEnd_toEndOf="parent"
app:layout_constraintTop_toTopOf="parent">
<androidx.appcompat.widget.AppCompatImageView
android:id="@+id/bottom_sheet_poi_thumbnail"
android:layout_width="match_parent"
android:layout_height="wrap_content"/>
</androidx.cardview.widget.CardView>
<LinearLayout
android:id="@+id/bottom_sheet_poi_schedule_layout"
android:layout_width="0dp"
android:layout_height="wrap_content"
android:layout_marginTop="8dp"
android:layout_marginStart="16dp"
android:layout_marginEnd="16dp"
android:orientation="vertical"
app:layout_constraintTop_toBottomOf="@+id/bottom_sheet_poi_thumbnail_card"
app:layout_constraintStart_toStartOf="parent"
app:layout_constraintEnd_toEndOf="parent">
<androidx.appcompat.widget.AppCompatTextView
android:layout_width="match_parent"
android:layout_height="wrap_content"
android:textColor="@color/colorBlackToWhite"
android:textAlignment="textStart"
android:textStyle="bold"
android:text="@string/move_schedule"/>
<com.acheteza.htauicomponents.WrapContentHeightViewPager
android:id="@+id/bottom_sheet_poi_schedule"
android:layout_width="match_parent"
android:layout_height="wrap_content"
android:layout_marginTop="8dp"
android:fillViewport="true"/>
</LinearLayout>
<LinearLayout
android:id="@+id/bottom_sheet_poi_contact_layout_extended"
android:layout_width="0dp"
android:layout_height="wrap_content"
android:orientation="vertical"
android:layout_marginTop="8dp"
android:layout_marginStart="16dp"
android:layout_marginEnd="16dp"
app:layout_constraintStart_toStartOf="parent"
app:layout_constraintEnd_toEndOf="parent"
app:layout_constraintTop_toBottomOf="@+id/bottom_sheet_poi_schedule_layout">
<androidx.appcompat.widget.AppCompatTextView
android:layout_width="match_parent"
android:layout_height="wrap_content"
android:textColor="@color/colorBlackToWhite"
android:textAlignment="textStart"
android:textStyle="bold"
android:text="@string/move_contact"/>
<androidx.appcompat.widget.AppCompatTextView
android:id="@+id/bottom_sheet_poi_contact_phone_extended"
android:layout_width="match_parent"
android:layout_height="wrap_content"
android:textColor="@color/colorBlackToWhite"
android:gravity="center_vertical"
android:textSize="12sp"
android:layout_marginStart="16dp"
android:layout_marginTop="8dp"
android:drawablePadding="8dp"
android:drawableStart="@drawable/ic_phone"
android:clickable="true"
android:focusable="true"
android:foreground="?selectableItemBackgroundBorderless"/>
<androidx.appcompat.widget.AppCompatTextView
android:id="@+id/bottom_sheet_poi_contact_mail_extended"
android:layout_width="match_parent"
android:layout_height="wrap_content"
android:textColor="@color/colorBlackToWhite"
android:gravity="center_vertical"
android:textSize="12sp"
android:layout_marginStart="16dp"
android:layout_marginTop="8dp"
android:drawablePadding="8dp"
android:drawableStart="@drawable/ic_email"
android:clickable="true"
android:focusable="true"
android:foreground="?selectableItemBackgroundBorderless"/>
</LinearLayout>
<LinearLayout
android:id="@+id/bottom_sheet_poi_content_layout"
android:layout_width="0dp"
android:layout_height="wrap_content"
android:orientation="vertical"
android:layout_marginTop="8dp"
android:layout_marginStart="16dp"
android:layout_marginEnd="16dp"
android:layout_marginBottom="8dp"
app:layout_constraintStart_toStartOf="parent"
app:layout_constraintEnd_toEndOf="parent"
app:layout_constraintTop_toBottomOf="@+id/bottom_sheet_poi_contact_layout_extended">
<androidx.appcompat.widget.AppCompatTextView
android:layout_width="match_parent"
android:layout_height="wrap_content"
android:textColor="@color/colorBlackToWhite"
android:textAlignment="textStart"
android:textStyle="bold"
android:text="@string/move_content"/>
<androidx.appcompat.widget.AppCompatTextView
android:id="@+id/bottom_sheet_poi_content"
android:layout_width="match_parent"
android:layout_height="wrap_content"
android:layout_marginTop="8dp"
android:layout_marginStart="16dp"
android:textColor="@color/colorBlackToWhite"
android:textAlignment="textStart"
android:autoLink="all"/>
</LinearLayout>
</androidx.constraintlayout.widget.ConstraintLayout>
</androidx.core.widget.NestedScrollView>
</LinearLayout>
</FrameLayout>