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>