小编Dan*_*ila的帖子

CoordinatorLayout不适用于ViewPager中Fragment内的NestedScrollView

我有一个下一个布局的活动

活动布局

<?xml version="1.0" encoding="utf-8"?>
Run Code Online (Sandbox Code Playgroud)

<android.support.design.widget.AppBarLayout
    android:id="@+id/issue_browse_app_bar_layout"
    android:layout_width="match_parent"
    android:layout_height="wrap_content"
    android:background="@color/app_default_color"
    app:popupTheme="@style/ThemeOverlay.AppCompat.Light"
    app:theme="@style/ThemeOverlay.AppCompat.Dark.ActionBar">

    <android.support.v7.widget.Toolbar
        android:id="@+id/issue_browse_toolbar"
        app:layout_scrollFlags="scroll|enterAlways"
        android:layout_width="match_parent"
        android:layout_height="?attr/actionBarSize" />

    <android.support.design.widget.TabLayout
        android:id="@+id/issue_browse_tab_layout"
        android:layout_width="match_parent"
        android:layout_height="wrap_content"

        />
</android.support.design.widget.AppBarLayout>

<android.support.v4.view.ViewPager
    android:id="@+id/issue_browse_view_pager"
    android:layout_width="match_parent"
    android:layout_height="match_parent"
    app:layout_behavior="@string/appbar_scrolling_view_behavior" />
Run Code Online (Sandbox Code Playgroud)

实例化后的ViewPager有2个片段

第一个可见片段的布局

    <?xml version="1.0" encoding="utf-8"?>
<ViewSwitcher xmlns:android="http://schemas.android.com/apk/res/android"
    xmlns:app="http://schemas.android.com/apk/res-auto"
    android:id="@+id/issue_browse_view_switcher"
    android:layout_width="match_parent"
    android:layout_height="match_parent"
    android:background="@color/white">

    <FrameLayout
        android:id="@+id/issue_browse_status_buttons_container"
        android:layout_width="match_parent"
        android:layout_height="match_parent">


        <android.support.v4.widget.NestedScrollView
            android:layout_width="match_parent"
            android:layout_height="match_parent"
            android:layout_marginBottom="@dimen/issue_status_browse_buttons"
            app:layout_behavior="@string/appbar_scrolling_view_behavior"
            >

            <LinearLayout
                android:layout_width="match_parent"
                android:layout_height="wrap_content"
                android:orientation="vertical">

                <LinearLayout
                    android:id="@+id/issue_browse_fragment_view_container"
                    android:layout_width="match_parent"
                    android:layout_height="wrap_content"
                    android:orientation="vertical" />

                <TextView
                    android:layout_width="match_parent"
                    android:layout_height="wrap_content"
                    android:text="start" />

                <TextView
                    android:layout_width="match_parent"
                    android:layout_height="wrap_content"
                    android:layout_gravity="bottom"
                    android:layout_marginTop="1000dp"
                    android:text="end" />

            </LinearLayout>
        </android.support.v4.widget.NestedScrollView>
    </FrameLayout>

    <LinearLayout
        android:layout_width="match_parent"
        android:layout_height="wrap_content" …
Run Code Online (Sandbox Code Playgroud)

android-layout android-fragments android-viewpager android-toolbar android-coordinatorlayout

9
推荐指数
1
解决办法
1737
查看次数