youlookwhat / ByRecyclerView

🔥 RecyclerView 下拉刷新、上拉松手/自动加载更多、item点击/长按、item局部刷新、头布局/尾布局/状态布局、万能分割线、Skeleton骨架图、极简adapter、嵌套滑动置顶
https://youlookwhat.github.io/ByRecyclerView
Apache License 2.0
798 stars 139 forks source link

GridSpaceItemDecoration #17

Closed mosentest closed 3 years ago

mosentest commented 4 years ago

怎么设置颜色

youlookwhat commented 4 years ago

它主要是间隔作用,颜色就是背景色,看你设置背景色能不能达到需求,不能的话我处理一下可以设置分隔颜色的情况吧。

mosentest commented 4 years ago

我背景没颜色,我直线通过add添加颜色,我网上找了别的工具类替代了

mosentest commented 4 years ago

addHeaderView 这个怎么设置了没法剧中呢??

<?xml version="1.0" encoding="utf-8"?>
<layout 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">

    <data>

    </data>

    <FrameLayout
        android:layout_width="match_parent"
        android:layout_height="wrap_content"
        android:layout_gravity="center_horizontal"
        android:background="?android:selectableItemBackground"
        android:orientation="vertical"
        android:padding="@dimen/dp_10">

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

            <ImageView
                android:id="@+id/ivRes"
                android:layout_width="wrap_content"
                android:layout_height="wrap_content"
                android:layout_gravity="center"
                app:srcCompat="@mipmap/ic_launcher_foreground" />

            <TextView
                android:id="@+id/tvName"
                android:layout_width="wrap_content"
                android:layout_height="wrap_content"
                android:layout_gravity="center"
                android:layout_marginStart="@dimen/dp_8"
                android:layout_marginTop="@dimen/dp_8"
                android:layout_marginEnd="@dimen/dp_8"
                android:gravity="center"
                android:text="@string/app_name"
                android:textColor="@color/color_333333"
                android:textSize="@dimen/sp_14"
                tools:text="@string/app_name" />
        </LinearLayout>
    </FrameLayout>
</layout>
mosentest commented 4 years ago
val mMainMenuHeaderBinding = DataBindingUtil.inflate<ActivityMainMenuHeaderBinding>(
            LayoutInflater.from(this),
            R.layout.activity_main_menu_header,
            null,
            false
        )
        mViewDataBinding.includeDrawerlayout.rvMenu.addHeaderView(mMainMenuHeaderBinding.root)
youlookwhat commented 4 years ago
val mMainMenuHeaderBinding = DataBindingUtil.inflate<ActivityMainMenuHeaderBinding>(
            LayoutInflater.from(this),
            R.layout.activity_main_menu_header,
            recyclerView.getParent(),
            false
        )

主要是第三个参数:recyclerView.getParent()