1

ビューページャーを使用していますが、ビューページャーで使用されるフラグメントには、ネストされたスクロールビューに囲まれたリストビューがあります。しかし、スクロールしてもツールバーが消えません。プレイストアのタブと同じように実行したい。listviewの代わりにrecyclerviewを使えばうまくいくと書いてありますが、listviewを使いたいです。

アクティビティのコードは次のとおりです。

<android.support.design.widget.CoordinatorLayout xmlns:android="http://schemas.android.com/apk/res/android"
xmlns:app="http://schemas.android.com/apk/res-auto"
android:layout_width="match_parent"
android:layout_height="match_parent">

<android.support.design.widget.AppBarLayout
    android:layout_width="match_parent"
    android:layout_height="wrap_content"
    android:theme="@style/ThemeOverlay.AppCompat.Dark.ActionBar">

    <android.support.v7.widget.Toolbar
        android:id="@+id/toolbar"
        android:layout_width="match_parent"
        android:layout_height="?attr/actionBarSize"
        android:background="#2196F3"
        app:layout_scrollFlags="scroll|enterAlways"
        app:popupTheme="@style/ThemeOverlay.AppCompat.Light" />

    <android.support.design.widget.TabLayout
        android:id="@+id/tabs"
        android:layout_width="match_parent"
        android:layout_height="wrap_content"
        android:background="#2196F3" />
</android.support.design.widget.AppBarLayout>


<android.support.v4.view.ViewPager
    android:id="@+id/viewpager"
    android:layout_width="match_parent"
    android:layout_height="match_parent"
    app:layout_behavior="@string/appbar_scrolling_view_behavior" />
</android.support.design.widget.CoordinatorLayout>

これは、ビュー ページャーで使用されるフラグメントのコードです。

<android.support.v4.widget.NestedScrollView
xmlns:android="http://schemas.android.com/apk/res/android"
android:layout_width="match_parent"
android:layout_height="match_parent">

<ListView
    android:id="@+id/list"
    android:layout_width="fill_parent"
    android:layout_height="match_parent"
    android:divider="#545454"
    android:dividerHeight="1dp"
    android:listSelector="@drawable/list_row_selector" />

</android.support.v4.widget.NestedScrollView>
4

0 に答える 0