我在 viewpager 中有一个回收 View ,但最后一行回收 View 不是完全可见的(即部分可见),因为底部导航 View 与 viewpager 重叠。我该如何解决这个问题?
activity_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"
xmlns:tools="http://schemas.android.com/tools"
android:id="@+id/container"
android:layout_width="match_parent"
android:layout_height="match_parent"
android:orientation="vertical"
tools:context="com.booksummary.booksummaryvideos.MainActivity">
<android.support.design.widget.AppBarLayout
android:id="@+id/appBarLayout"
android:layout_width="match_parent"
android:layout_height="wrap_content">
<android.support.v7.widget.Toolbar
android:id="@+id/my_toolbar"
android:layout_width="match_parent"
android:layout_height="?attr/actionBarSize"
android:background="#fff"
android:elevation="4dp"
android:gravity="start"
android:theme="@style/ThemeOverlay.AppCompat.ActionBar"
app:contentInsetLeft="0dp"
app:contentInsetStart="0dp"
app:layout_scrollFlags="scroll|enterAlways"
app:popupTheme="@style/ThemeOverlay.AppCompat.Light">
</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"
android:layout_weight="1"
app:layout_behavior="@string/appbar_scrolling_view_behavior" />
<android.support.design.widget.BottomNavigationView
android:id="@+id/navigation"
android:layout_width="match_parent"
android:layout_height="wrap_content"
android:layout_gravity="bottom"
android:background="?android:attr/windowBackground"
android:elevation="16dp"
app:itemIconTint="@drawable/selector"
app:itemTextColor="@drawable/selector"
app:menu="@menu/navigation" />
<!--android:background="?android:attr/windowBackground"-->
</android.support.design.widget.CoordinatorLayout>
最佳答案
问题是 BottomNavigationView
实际上与您的 ViewPager
重叠...
您可以更改布局,使 ViewPager
在 BottomNavigationView
上方结束
或
您需要将底部填充设置为 RecyclerView
上的 BottomNavigationView
的大小,并且(确保填充在最后一项之后)clipToPadding= “假”
关于android - CoordinatorLayout Android 中的底部导航栏与 viewpager 重叠,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/46515242/