0
Ich habe eine CollapsingToolbarLayout
und darunter habe ich eine LinearLayout
mit 2 fragments
und eine ViewPager
. Jedoch, wenn ich scroll, bleiben beide fragments
sticky und nur die viewpager
, die eine RecyclerView
enthält, scrollt richtig. Wie kann ich beide fragments
scrollable
auch machen?Fragmente über ViewPager nicht scrollen
<android.support.design.widget.AppBarLayout
android:id="@+id/appbar"
android:layout_width="match_parent"
android:layout_height="200dp"
android:theme="@style/ThemeOverlay.AppCompat.Dark.ActionBar"
android:fitsSystemWindows="true">
<android.support.design.widget.CollapsingToolbarLayout
android:id="@+id/collapsing_toolbar"
android:layout_width="match_parent"
android:layout_height="match_parent"
app:layout_scrollFlags="scroll|exitUntilCollapsed"
android:fitsSystemWindows="true"
app:contentScrim="?attr/colorPrimary"
app:expandedTitleMarginBottom="90dp"
app:expandedTitleMarginEnd="64dp">
<ImageView
android:id="@+id/hero"
android:layout_width="match_parent"
android:layout_height="match_parent"
android:scaleType="centerCrop"
android:fitsSystemWindows="true"
app:layout_collapseMode="parallax"/>
<android.support.v7.widget.Toolbar
android:id="@+id/toolbar"
android:layout_width="match_parent"
android:layout_height="?attr/actionBarSize"
android:layout_gravity="top"
app:popupTheme="@style/ThemeOverlay.AppCompat.Light"
app:layout_collapseMode="pin" />
<android.support.design.widget.TabLayout
android:id="@+id/tab_layout"
android:layout_width="match_parent"
android:layout_height="wrap_content"
style="@style/MyCustomTabLayout"
android:layout_gravity="bottom"
app:layout_collapseMode="pin"
app:tabMode="scrollable"/>
<LinearLayout android:id="@+id/ButtonBar"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:orientation="horizontal"
android:layout_gravity="center|start"
app:layout_collapseMode="pin"
android:fitsSystemWindows="true"
android:layout_marginTop="40dp"
android:layout_marginLeft="24dp"
android:padding="@dimen/activity_horizontal_margin_half">
<TextView
android:id="@+id/SignUpButton"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:text="Sign Up"
android:textAllCaps="true"
android:background="@drawable/rounded_border_white_inverted_selector"
android:textColor="@drawable/rounded_border_white_text_inverted_selector"
android:padding="@dimen/activity_horizontal_margin_half"/>
<TextView
android:id="@+id/LoginButton"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:text="Login"
android:textAllCaps="true"
android:layout_marginLeft="@dimen/activity_horizontal_margin_half"
android:background="@drawable/rounded_border_white_selector"
android:textColor="@drawable/rounded_border_white_text_selector"
android:padding="@dimen/activity_horizontal_margin_half"/>
</LinearLayout>
</android.support.design.widget.CollapsingToolbarLayout>
</android.support.design.widget.AppBarLayout>
<LinearLayout
android:layout_width="match_parent"
android:layout_height="match_parent"
android:orientation="vertical"
app:layout_behavior="@string/appbar_scrolling_view_behavior">
<fragment
android:id="@+id/fragmentSponsored"
android:name="SponsoredFragment"
android:layout_width="match_parent"
android:layout_height="wrap_content"
tools:layout="@layout/fragment_sponsored" />
<fragment
android:id="@+id/fragmentAnnouncement"
android:name="AnnouncementFragment"
android:layout_width="match_parent"
android:layout_height="wrap_content"
tools:layout="@layout/fragment_announcement" />
<android.support.v4.view.ViewPager
android:id="@+id/pager"
android:layout_width="match_parent"
android:layout_height="match_parent"/>
</LinearLayout>
Vielen Dank für Ihre Antwort, aber dass das Problem nicht ansprechen. Mit scrollbar meine ich auf und ab, nicht nach links und rechts wischen. Wenn ich die RecyclerView auf dem ViewPager scrolle, werden die zwei Fragmente oben auf dem ViewPager an die Spitze geklebt. Ich möchte sie auch scrollbar machen. – pindleskin