Warning: file_get_contents(/data/phpspider/zhask/data//catemap/3/android/205.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 ConstraintLayout RecyclerView显示在BottomNavigationView下_Android_Android Recyclerview_Android Constraintlayout - Fatal编程技术网

Android ConstraintLayout RecyclerView显示在BottomNavigationView下

Android ConstraintLayout RecyclerView显示在BottomNavigationView下,android,android-recyclerview,android-constraintlayout,Android,Android Recyclerview,Android Constraintlayout,如何使用ConstraintLayout使RecyclerView不显示在BottomNavigationView下 结果如下(回收商应显示20个元素) 这是xml <?xml version="1.0" encoding="utf-8"?> <android.support.constraint.ConstraintLayout xmlns:android="http://schemas.android.com/apk/res/android" xmlns:

如何使用ConstraintLayout使RecyclerView不显示在BottomNavigationView下

结果如下(回收商应显示20个元素)

这是xml

<?xml version="1.0" encoding="utf-8"?>
<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:id="@+id/container"
    android:layout_width="match_parent"
    android:layout_height="match_parent"
    tools:context=".MainActivity">

    <android.support.v7.widget.RecyclerView
        android:id="@+id/myListSimple"
        android:scrollbars="vertical"
        android:layout_width="match_parent"
        android:layout_height="match_parent"/>

    <android.support.design.widget.BottomNavigationView
        android:id="@+id/navigation"
        android:layout_width="0dp"
        android:layout_height="wrap_content"
        android:layout_marginEnd="0dp"
        android:layout_marginStart="0dp"
        android:background="?android:attr/windowBackground"
        app:layout_constraintBottom_toBottomOf="parent"
        app:layout_constraintLeft_toLeftOf="parent"
        app:layout_constraintRight_toRightOf="parent"
        app:menu="@menu/navigation"/>

</android.support.constraint.ConstraintLayout>

您正在对
ConstraintLayout
中包含的
视图中的
android:layout\u width
android:layout\u height
使用
match\u parent
。您应该使用
0dp
来匹配约束:

<android.support.v7.widget.RecyclerView
    android:id="@+id/myListSimple"
    android:scrollbars="vertical"
    android:layout_width="0dp"
    android:layout_height="0dp"
    app:layout_constraintBottom_toTopOf="@id/navigation"
    app:layout_constraintLeft_toLeftOf="parent"
    app:layout_constraintRight_toRightOf="parent"
    app:layout_constraintTop_toTopOf="parent" />


尝试将
RecyclerView
s constraint bottom定义为
BottomNavigationView
@dgngulcan:thanx的顶部,我已经尝试过了,但效果不太好如果可以的话,我会给出我所有的观点,我在这方面浪费了很多时间。有关于此解决方案的文档吗?在“尺寸约束”一节中有提及。