android开发分享Android ConstraintLayout 下 RecyclerView 的底部数据显示不全解决方案

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="https://schemas.android.com/apk/res/android"     xmlns:app="https://schemas.android.com/apk/res-auto"     xmlns:tools="https://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>

本文来自网络收集,不代表计算机技术网立场,如涉及侵权请联系管理员删除。

ctvol管理联系方式QQ:251552304

本文章地址:https://www.ctvol.com/addevelopment/892633.html

(0)
上一篇 2021年10月20日
下一篇 2021年10月20日

精彩推荐