首页 > 解决方案 > RecyclerView 添加分隔线

问题描述

我的活动有一个RecyclerView. 请看图片。分开
的2 个部分。RecyclerView第一部分是俯视图。只是展示一些关于应用程序的价值。第二部分是日历。我想添加行来检查栏是否达到目标。只有第二部分有分隔线我尝试了很多方法,但我无法将该行添加到第二部分。

<?xml version="1.0" encoding="utf-8"?>
<RelativeLayout 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"
android:background="@drawable/gray_bg"
android:orientation="vertical">

<LinearLayout
    android:layout_width="match_parent"
    android:layout_height="match_parent"
    android:orientation="vertical">

    <ImageView
        android:id="@+id/imageView5"
        android:layout_width="match_parent"
        android:layout_height="wrap_content"
        android:src="@drawable/history_norm_delimiter" />

    <ImageView
        android:id="@+id/imageView11"
        android:layout_width="match_parent"
        android:layout_height="wrap_content"
        android:src="@drawable/history_norm_delimiter" />

    <ImageView
        android:id="@+id/imageView10"
        android:layout_width="match_parent"
        android:layout_height="wrap_content"
        android:src="@drawable/history_norm_delimiter" />

    <ImageView
        android:id="@+id/imageView9"
        android:layout_width="match_parent"
        android:layout_height="wrap_content"
        android:src="@drawable/history_norm_delimiter" />

    <ImageView
        android:id="@+id/imageView8"
        android:layout_width="match_parent"
        android:layout_height="wrap_content"
        android:src="@drawable/history_norm_delimiter" />

    <ImageView
        android:id="@+id/imageView7"
        android:layout_width="match_parent"
        android:layout_height="wrap_content"
        android:src="@drawable/history_norm_delimiter" />

    <ImageView
        android:id="@+id/imageView6"
        android:layout_width="match_parent"
        android:layout_height="wrap_content"
        android:src="@drawable/history_norm_delimiter" />
</LinearLayout>

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

</android.support.v7.widget.RecyclerView>

图像视图是分隔线。但它不在RecyclerView. 我想将它添加到RecyclerView.

标签: javaandroidandroid-recyclerview

解决方案


推荐阅读