【发布时间】:2018-10-14 17:48:47
【问题描述】:
从 2 个月开始,我一直在使用 ConstrainLayout,但每次我都会遇到一些问题,并且在花了很多时间之后我找到了解决方案,但现在我陷入了死锁。我的视图上部被状态栏隐藏,下部也被导航栏隐藏。
在这里您可以看到我的 AppBar 位于状态栏下方,并且 RecyclerView 最后一项未显示完整。它的某些视图是不可见的。
我不确定问题出在哪里,以前我通过添加android:fitsSystemWindows="true" 来解决此类问题,但现在它无法正常工作。当我尝试应用谷歌结果时,它的行为也有所不同。
这是我的视图xml代码
<android.support.constraint.ConstraintLayout 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="wrap_content"
android:fitsSystemWindows="true">
<android.support.design.widget.AppBarLayout xmlns:android="http://schemas.android.com/apk/res/android"
xmlns:app="http://schemas.android.com/apk/res-auto"
android:id="@+id/app_bar"
android:layout_width="match_parent"
android:layout_height="wrap_content"
android:fitsSystemWindows="true"
android:theme="@style/AppTheme.AppBarOverlay"
app:layout_constraintBottom_toTopOf="@id/shop_recycler_view"
app:layout_constraintEnd_toEndOf="parent"
app:layout_constraintStart_toStartOf="parent"
app:layout_constraintTop_toTopOf="parent">
<android.support.v7.widget.Toolbar
android:id="@+id/toolbar"
android:layout_width="match_parent"
android:layout_height="?attr/actionBarSize"
android:background="?attr/colorPrimary"
app:popupTheme="@style/AppTheme.PopupOverlay" />
</android.support.design.widget.AppBarLayout>
<android.support.v7.widget.RecyclerView
android:id="@+id/shop_recycler_view"
android:layout_width="match_parent"
android:layout_height="wrap_content"
android:layout_marginLeft="5dp"
android:layout_marginRight="5dp"
android:fitsSystemWindows="true"
android:scrollbars="vertical"
app:layout_constraintBottom_toBottomOf="parent"
app:layout_constraintEnd_toEndOf="parent"
app:layout_constraintStart_toStartOf="parent"
app:layout_constraintTop_toBottomOf="@id/app_bar"
tools:listitem="@layout/shop_list_recycler_view_row" />
</android.support.constraint.ConstraintLayout>
【问题讨论】:
标签: android android-recyclerview overlap android-constraintlayout invisible