
main.xml
<?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" android:layout_width="match_parent" android:layout_height="match_parent" android:fitsSystemWindows="true"> <android.support.design.widget.AppBarLayout android:layout_width="match_parent" android:layout_height="wrap_content" android:fitsSystemWindows="true"> <android.support.v7.widget.Toolbar android:id="@+id/toolbar" android:layout_width="match_parent" android:layout_height="?attr/actionBarSize" android:elevation="4dp" app:layout_scrollFlags="scroll|enterAlways" app:popupTheme="@style/ThemeOverlay.AppCompat.Light"/> <android.support.design.widget.TabLayout android:id="@+id/tabLayout" android:layout_width="match_parent" android:layout_height="wrap_content" android:background="@color/toolbar_color" /> </android.support.design.widget.AppBarLayout> <android.support.v4.view.ViewPager android:id="@+id/pager" android:layout_width="match_parent" android:layout_height="wrap_content" app:layout_behavior="@string/appbar_scrolling_view_behavior"/> </android.support.design.widget.CoordinatorLayout> 我是根据网上的方法来做的,在我的 6.0 的手机上会多显示一块区域,但是在 4.4 上却是正常的,希望可以指明一下哪里有问题。手机图片
1 cppgohan 2016 年 7 月 16 日 我看出来的一点是 ViewPager 高度应该 match_parent |
2 hackerwgf PRO 是指 viewpager 和 toolbar 之间的那个缝隙嘛? |
3 bqbkbz 2016 年 7 月 16 日 AppBarLayout 里面的 fitsSystemWindows 去掉试试 |
5 L4D 2016 年 7 月 16 日 via Android viewpager 里面的 view 是不是设了 margin 或 padding |
6 ilumer OP @zhaohui318 谢谢你的帮助,我看了一下 fitsystemwibdow 的介绍,没有理解为什么会出现这个问题。 |
7 bqbkbz 2016 年 7 月 16 日 fitsystemwibdow="true" 会使控件增加一个 状态栏的高度, 具体表现不同的版本出入很大,透明状态栏想要适配完美是一个难题。 |
8 ilumer OP @zhaohui318 看来我理解错了,我看网上的解释是这个属性属性必须用在 content view 的根 view 中,尽管所有的 view 都可以添加这个属性。 |