Warning: file_get_contents(/data/phpspider/zhask/data//catemap/3/android/213.json): failed to open stream: No such file or directory in /data/phpspider/zhask/libs/function.php on line 167

Warning: Invalid argument supplied for foreach() in /data/phpspider/zhask/libs/tag.function.php on line 1116

Notice: Undefined index: in /data/phpspider/zhask/libs/function.php on line 180

Warning: array_chunk() expects parameter 1 to be array, null given in /data/phpspider/zhask/libs/function.php on line 181
Android 折叠工具栏无法在选项卡布局下显示viewpager的内容_Android - Fatal编程技术网

Android 折叠工具栏无法在选项卡布局下显示viewpager的内容

Android 折叠工具栏无法在选项卡布局下显示viewpager的内容,android,Android,我的代码如下所示: <?xml version="1.0" encoding="utf-8"?> <android.support.design.widget.CoordinatorLayout xmlns:android="http://schemas.android.com/apk/res/android" xmlns:app="http://schemas.android.com/apk/res-auto" xmlns:tools="http://sche

我的代码如下所示:

<?xml version="1.0" encoding="utf-8"?>
<android.support.design.widget.CoordinatorLayout 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:fitsSystemWindows="true">

    <android.support.design.widget.AppBarLayout
        android:id="@+id/appBar"
        android:layout_width="match_parent"
        android:layout_height="300dp"
        android:fitsSystemWindows="true"
        android:theme="@style/ThemeOverlay.AppCompat.Dark.ActionBar">

        <android.support.design.widget.CollapsingToolbarLayout
            android:id="@+id/collapsingToolbar"
            android:layout_width="match_parent"
            android:layout_height="match_parent"
            android:fitsSystemWindows="true"
            app:contentScrim="?attr/colorPrimary"
            app:expandedTitleMarginEnd="64dp"
            app:expandedTitleMarginStart="48dp"
            app:layout_scrollFlags="scroll|exitUntilCollapsed"
            app:title="Test">

            <ImageView
                android:id="@+id/toolbarImage"
                android:layout_width="match_parent"
                android:layout_height="match_parent"
                android:fitsSystemWindows="true"
                android:scaleType="centerCrop"
                android:src="@drawable/truck_test"
                app:layout_collapseMode="parallax" />

            <android.support.v7.widget.Toolbar
                android:id="@+id/toolbar"
                android:layout_width="match_parent"
                android:layout_height="?attr/actionBarSize"
                app:layout_collapseMode="pin"
                app:popupTheme="@style/ThemeOverlay.AppCompat.Light" />
        </android.support.design.widget.CollapsingToolbarLayout>
    </android.support.design.widget.AppBarLayout>

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

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

            <android.support.design.widget.TabLayout
                android:id="@+id/tabsMain"
                android:layout_width="match_parent"
                android:layout_height="45dp"
                android:layout_below="@+id/toolbar"
                android:background="@android:color/white"
                app:tabGravity="fill"
                app:tabIndicatorHeight="5dp"
                app:tabMaxWidth="156dp"
                app:tabMinWidth="148dp"
                app:tabMode="fixed"
                app:tabSelectedTextColor="@color/colorRoyalPurple"
                app:tabTextColor="@color/colorGray89" />

            <android.support.v4.view.ViewPager
                android:id="@+id/viewpagerMain"
                android:layout_width="match_parent"
                android:layout_height="match_parent"
                android:layout_below="@+id/tabsMain"
                android:background="@color/colorMercuryE1"
                android:clipToPadding="false"
                android:paddingTop="10dp" />

            <LinearLayout
                android:id="@+id/showCart"
                android:layout_width="match_parent"
                android:layout_height="53dp"
                android:layout_alignParentBottom="true"
                android:background="@color/colorRoyalPurple"
                android:orientation="horizontal"
                android:visibility="invisible">

                <LinearLayout
                    android:layout_width="0dp"
                    android:layout_height="wrap_content"
                    android:layout_weight="1"
                    android:orientation="vertical">

                    <TextView
                        android:id="@+id/itemCartText"
                        android:layout_width="wrap_content"
                        android:layout_height="wrap_content"
                        android:layout_gravity="end"
                        android:layout_marginTop="10dp"
                        android:text="1"
                        android:textColor="@android:color/white"
                        android:textSize="12sp" />


                    <TextView
                        android:id="@+id/viewCart"
                        android:layout_width="wrap_content"
                        android:layout_height="wrap_content"
                        android:layout_gravity="end"
                        android:text="View Cart"
                        android:textColor="@android:color/white"
                        android:textSize="15sp" />

                </LinearLayout>

                <ImageView
                    android:layout_width="15dp"
                    android:layout_height="15dp"
                    android:layout_gravity="center_vertical"
                    android:layout_marginLeft="15dp"
                    android:layout_marginRight="10dp"
                    android:background="@drawable/icon_arrow" />
            </LinearLayout>

        </LinearLayout>
    </android.support.v4.widget.NestedScrollView>
</android.support.design.widget.CoordinatorLayout>


. 那么,如何在选项卡布局下显示viewpager?

将表格布局移到折叠工具栏内的工具栏下方

将表格布局移到折叠工具栏内的工具栏下方

在appbar布局中移动表格布局代码否,它不起作用。如果我将tab布局移动到appbar布局,它会粘在顶部,视差效果会达到您所需要的效果?在appbar布局中移动您的TableLayout代码否,它不起作用。如果我将tab布局移动到appbar布局,它会粘在顶部,视差效果就好了。你到底需要什么?