Я пытаюсь прокрутить содержимое окна просмотра карты, когда прокрутка завершена, у меня есть пейджер просмотра, содержащий макет вкладок под видом карты, который я хочу прикрепить этот пейджер просмотра под панелью инструментов.
Например : Моя структура макета перед прокруткой
----------------
ToolBar
----------------
Cardview
contents
.
.
.
.
----------------
ViewPager
TabLayout
-----------------
, и когда прокручивается это содержимое Card View, мне нужна структура, как показано ниже.
----------------
ToolBar
----------------
ViewPager
TabLayout
-----------------
Я пытаюсь прикрепить свой ViewPager под панелью инструментов, когда карточный вид полностью прокручен. Я разработал макет. xml, как показано ниже.
<?xml version="1.0" encoding="utf-8"?>
<LinearLayout
android:orientation="vertical"
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:background="#e6e6e6"
tools:context=".ViewerActivity">
<androidx.appcompat.widget.Toolbar
app:title="Post View"
android:id="@+id/PostViewerToolbar"
android:layout_width="match_parent"
android:layout_height="wrap_content"/>
<ScrollView
android:layout_width="match_parent"
android:layout_height="wrap_content"
tools:ignore="ScrollViewCount">
<LinearLayout
android:orientation="vertical"
android:layout_width="match_parent"
android:layout_height="match_parent">
<androidx.cardview.widget.CardView
android:layout_width="match_parent"
android:layout_height="wrap_content">
<ImageView
android:layout_marginTop="10dp"
android:id="@+id/SharedImg"
android:layout_gravity="center_horizontal"
android:adjustViewBounds="true"
android:layout_width="match_parent"
android:layout_height="wrap_content"/>
<View
android:layout_marginTop="10dp"
android:background="#f1f1f1"
android:layout_width="match_parent"
android:layout_height="2dp"/>
<TextView
android:layout_marginTop="10dp"
android:id="@+id/DescriptionTv"
android:text="Post description"
android:layout_width="match_parent"
android:layout_height="wrap_content"/>
</LinearLayout>
</androidx.cardview.widget.CardView>
</LinearLayout>
</ScrollView>
<androidx.viewpager.widget.ViewPager
android:id="@+id/Viewpager"
android:layout_marginTop="5dp"
android:layout_width="match_parent"
android:layout_height="match_parent">
<com.google.android.material.tabs.TabLayout
android:id="@+id/InvolveTabLayout"
android:layout_width="match_parent"
android:layout_height="wrap_content"/>
</androidx.viewpager.widget.ViewPager>
</LinearLayout>
Как это сделать. Пожалуйста, помогите.