有关RecyclerView的一些细节

    xiaoxiao2021-03-26  29

    如果想给RecyclerView增加头布局的话, 首先:导包 compile 'com.bartoszlipinski.recyclerviewheader:library:1.2.0' compile 'com.android.support:recyclerview-v7:25.1.0' 在设置了适配器以后, RecyclerViewHeader header = (RecyclerViewHeader) findViewById(R.id.rch); header.attachTo(mRecyclerView,true); 在布局文件中: <android.support.v7.widget.RecyclerView android:layout_below="@id/rl" android:id="@+id/rv_list" android:layout_width="match_parent" android:layout_height="match_parent"/> <com.bartoszlipinski.recyclerviewheader.RecyclerViewHeader android:id="@+id/rch" android:layout_width="match_parent" android:layout_height="100dp"> <ImageView android:background="#ff00" android:id="@+id/headimg1" android:layout_width="match_parent" android:layout_height="match_parent" /> </com.bartoszlipinski.recyclerviewheader.RecyclerViewHeader>
    转载请注明原文地址: https://ju.6miu.com/read-663308.html

    最新回复(0)