RecyclerView

时间:2019-08-18
本文章向大家介绍RecyclerView,主要包括RecyclerView使用实例、应用技巧、基本知识点总结和需要注意事项,具有一定的参考价值,需要的朋友可以参考一下。

<?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:layout_width="match_parent"
android:layout_height="match_parent">

<Button
android:id="@+id/removeButton"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:layout_marginBottom="9dp"
android:layout_weight="1"
android:text="删除"
app:layout_constraintBottom_toTopOf="@+id/recycleview"
app:layout_constraintEnd_toEndOf="parent"
app:layout_constraintStart_toEndOf="@+id/addButton"
app:layout_constraintTop_toTopOf="parent" />

<Button
android:id="@+id/addButton"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:layout_marginBottom="9dp"
android:layout_marginEnd="17dp"
android:layout_marginStart="9dp"
android:layout_weight="1"
android:text="添加"
app:layout_constraintBottom_toTopOf="@+id/recycleview"
app:layout_constraintEnd_toStartOf="@+id/removeButton"
app:layout_constraintHorizontal_chainStyle="packed"
app:layout_constraintStart_toStartOf="parent"
app:layout_constraintTop_toTopOf="parent" />

<android.support.v7.widget.RecyclerView
android:id="@+id/recycleview"
android:layout_width="0dp"
android:layout_height="0dp"
android:layout_marginBottom="12dp"
app:layout_constraintBottom_toBottomOf="parent"
app:layout_constraintEnd_toEndOf="parent"
app:layout_constraintStart_toStartOf="parent"
app:layout_constraintTop_toBottomOf="@+id/removeButton" />
</android.support.constraint.ConstraintLayout>

原文地址:https://www.cnblogs.com/hyhy904/p/11373120.html