Android ViewPager和其他视图组在协调布局中不工作
我观察到,将appbar\u scrolling\u view\u行为添加到ViewPager中,并且ViewPager不是全屏的(在我的例子中包含一些底部按钮/选项卡),则ViewPager的高度更高(我猜是工具栏的高度),并且与其他布局重叠(在我的例子中是那些选项卡) 请参见下面的图片(其中一个是向上滚动的工具栏) 这是xml:Android ViewPager和其他视图组在协调布局中不工作,android,android-viewpager,android-toolbar,android-design-library,Android,Android Viewpager,Android Toolbar,Android Design Library,我观察到,将appbar\u scrolling\u view\u行为添加到ViewPager中,并且ViewPager不是全屏的(在我的例子中包含一些底部按钮/选项卡),则ViewPager的高度更高(我猜是工具栏的高度),并且与其他布局重叠(在我的例子中是那些选项卡) 请参见下面的图片(其中一个是向上滚动的工具栏) 这是xml: <?xml version="1.0" encoding="utf-8"?> <RelativeLayout xmlns:android="h
<?xml version="1.0" encoding="utf-8"?>
<RelativeLayout
xmlns:android="http://schemas.android.com/apk/res/android"
xmlns:tools="http://schemas.android.com/tools"
xmlns:app="http://schemas.android.com/apk/res-auto"
tools:context=".AudioRecActivity"
android:layout_width="match_parent"
android:layout_height="match_parent"
android:fitsSystemWindows="true">
<android.support.design.widget.CoordinatorLayout
android:id="@+id/main_content"
android:layout_width="match_parent"
android:layout_height="match_parent"
android:layout_above="@+id/bottomLayout">
<android.support.design.widget.AppBarLayout android:id="@+id/appbar"
android:layout_width="match_parent"
android:layout_height="wrap_content"
android:theme="@style/AppTheme.AppBarOverlay"
app:elevation="0dp">
<android.support.v7.widget.Toolbar android:id="@+id/acb_toolbar"
android:layout_width="match_parent"
android:layout_height="?attr/actionBarSize"
android:background="?attr/colorPrimary"
android:theme="@style/AppTheme.AppBarOverlay"
app:popupTheme="@style/AppTheme.PopupOverlay"
app:layout_scrollFlags="scroll|enterAlways">
</android.support.v7.widget.Toolbar>
</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>
<LinearLayout
android:id="@+id/bottomLayout"
android:orientation="vertical"
android:layout_width="match_parent"
android:layout_height="wrap_content"
android:layout_alignParentBottom="true">
<audiorec.com.gui.views.SlidingTabLayout
android:id="@+id/sliding_tabs"
android:layout_width="match_parent"
android:layout_height="wrap_content"
android:orientation="horizontal"
android:background="@color/secondary" >
</audiorec.com.gui.views.SlidingTabLayout>
<FrameLayout
android:id="@+id/adsContainer"
android:layout_width="match_parent"
android:layout_height="wrap_content"
android:background="@color/secondary" >
<TextView
android:id="@+id/loading_ad_tv"
android:layout_width="match_parent"
android:layout_height="wrap_content"
android:gravity="center"
android:text="@string/advertisement_loading"
android:textAppearance="?android:attr/textAppearanceSmall"
android:textColor="#ffffff" />
</FrameLayout>
</LinearLayout>
如果我指定不在该线性布局下,ViewPager/Coordinator布局内容如何在该线性布局下?我在这里找到了一个答案:并且对我也适用
这似乎是安卓团队的“问题”……请参见此处: