当前位置: 移动技术网 > 移动技术>移动开发>Android > Android ConstraintLayout 下 RecyclerView 的底部数据显示不全解决方案

Android ConstraintLayout 下 RecyclerView 的底部数据显示不全解决方案

2020年09月29日  | 移动技术网移动技术  | 我要评论
ConstraintLayout可真是解决了各种层级嵌套的问题,很Nice今天帮同事排查一个Bug,Android ConstraintLayout 下 RecyclerView 的底部数据显示,指定了topToBottomOf 但是最后一条数据只显示一半,经过排查和解决,发现他没有指定Bottom,也就是app:layout_constraintBottom_toBottomOf="parent"然后高度设置为0dp就可代码:<?xml version="1...

ConstraintLayout可真是解决了各种层级嵌套的问题,很Nice

今天帮同事排查一个Bug,Android ConstraintLayout 下 RecyclerView 的底部数据显示,

指定了topToBottomOf 但是最后一条数据只显示一半,经过排查和解决,发现他没有指定Bottom,也就是

app:layout_constraintBottom_toBottomOf="parent"

然后高度设置为0dp就可

 

 

代码:

<?xml version="1.0" encoding="utf-8"?>
<androidx.constraintlayout.widget.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="match_parent"
    tools:context="com.luxiaofeng.ui.home.LookCarPointActivity">

    <com.luxiaofeng.widght.LuTitleLayout
        android:id="@id/title_see_look"
        app:layout_constraintTop_toTopOf="parent"
        app:titleText="@string/see"
        android:layout_width="match_parent"
        android:layout_height="wrap_content"/>


    <androidx.recyclerview.widget.RecyclerView
        app:layout_constraintBottom_toBottomOf="parent"
        android:id="@+id/recyclerview"
        app:layout_constraintTop_toBottomOf="@id/title_see_look"
        android:layout_width="match_parent"
        android:layout_height="0dp"/>
</androidx.constraintlayout.widget.ConstraintLayout>

本文地址:https://blog.csdn.net/qq_29769851/article/details/108864276

如您对本文有疑问或者有任何想说的,请点击进行留言回复,万千网友为您解惑!

相关文章:

验证码:
移动技术网