今天來(lái)使用BaseRecyclerViewAdapterHelper的分組布局功能
說(shuō)明:
一,使用的Androidstudio版本為3.3.2
二,BaseRecyclerViewAdapterHelper地址如下掀潮,使用可折疊的分組布局功能時(shí)adapter是繼承BaseMultiItemQuickAdapter运挫,多說(shuō)無(wú)意義,看如下效果圖。
三,這是BaseRecyclerViewAdapterHelper的系列的第七篇文章址遇,如有簡(jiǎn)單的不懂使用請(qǐng)看前面的文章。
github地址為:https://github.com/CymChad/BaseRecyclerViewAdapterHelper
展示效果:
現(xiàn)在正式開(kāi)始
1,一般分組布局的后臺(tái)返回?cái)?shù)據(jù)格式屋灌。
{
"Result":[
{
"title1":"我有一只小狗1",
"title2":"我有一只小狗2",
"list":[
{
"message1":"我有一只小狗我有一只小狗我有一只小狗我有一只小狗1",
"message2":"我有一只小狗我有一只小狗我有一只小狗我有一只小狗2"
},
{
"message1":"我有一只小狗我有一只小狗我有一只小狗我有一只小狗1",
"message2":"我有一只小狗我有一只小狗我有一只小狗我有一只小狗2"
}
]
},
{
"title1":"我有一只小狗1",
"title2":"我有一只小狗2",
"list":[
{
"message1":"我有一只小狗我有一只小狗我有一只小狗我有一只小狗1",
"message2":"我有一只小狗我有一只小狗我有一只小狗我有一只小狗2"
},
{
"message1":"我有一只小狗我有一只小狗我有一只小狗我有一只小狗1",
"message2":"我有一只小狗我有一只小狗我有一只小狗我有一只小狗2"
}
]
}
],
"Success":true,
"StatusCode":200
}
1,添加依賴(lài)
apply plugin: 'com.android.application'
android {
compileSdkVersion 28
defaultConfig {
applicationId "com.mumu.jsrecyclerview6"
minSdkVersion 19
targetSdkVersion 28
versionCode 1
versionName "1.0"
testInstrumentationRunner "android.support.test.runner.AndroidJUnitRunner"
}
buildTypes {
release {
minifyEnabled false
proguardFiles getDefaultProguardFile('proguard-android-optimize.txt'), 'proguard-rules.pro'
}
}
}
//2应狱,增加jitpack支持
allprojects {
repositories {
maven { url "https://jitpack.io" }
maven { url "https://maven.google.com" }
flatDir {
dirs 'libs'
}
}
}
dependencies {
implementation fileTree(dir: 'libs', include: ['*.jar'])
implementation 'com.android.support:appcompat-v7:28.0.0'
implementation 'com.android.support.constraint:constraint-layout:1.1.3'
testImplementation 'junit:junit:4.12'
androidTestImplementation 'com.android.support.test:runner:1.0.2'
androidTestImplementation 'com.android.support.test.espresso:espresso-core:3.0.2'
//butterKnife
implementation 'com.jakewharton:butterknife:8.8.1'
annotationProcessor 'com.jakewharton:butterknife-compiler:8.8.1'
//2共郭,增加recycle和對(duì)應(yīng)的適配器
implementation 'com.android.support:recyclerview-v7:28.0.0'
implementation 'com.github.CymChad:BaseRecyclerViewAdapterHelper:2.9.46'
//增加下拉刷新SmartRefreshLayout的依賴(lài)
implementation 'com.scwang.smartrefresh:SmartRefreshLayout:1.1.0-alpha-21'
implementation 'com.scwang.smartrefresh:SmartRefreshHeader:1.1.0-alpha-21'//沒(méi)有使用特殊Header,可以不加這行
}
3疾呻,MainActivity如下除嘹,主要是展示列表,其中有幾個(gè)需要注意的點(diǎn):一岸蜗,在initData()方法中我偽造了后臺(tái)的返回?cái)?shù)據(jù)尉咕,這兒著重注意,被展開(kāi)和被收縮的二級(jí)列表需要調(diào)用setSubItems()方法添加數(shù)據(jù)璃岳。正常的后臺(tái)數(shù)據(jù)返回是不會(huì)主動(dòng)添加到該列表中年缎,所以如果接口返回的時(shí)候,需要自己遍歷重新添加數(shù)據(jù)源铃慷。遍歷方法如下单芜。如果不使用該方法添加,會(huì)導(dǎo)致二級(jí)列表無(wú)法展開(kāi)枚冗,原因是二級(jí)列表中沒(méi)有數(shù)據(jù)缓溅。具體可以看源碼。二赁温,給每一個(gè)條目添加點(diǎn)擊事件是在對(duì)應(yīng)的適配器中添加坛怪,二對(duì)應(yīng)條目中的子view,如我demo中的小狗0股囊,小貓0袜匿,小小小狗0,小小小貓0都是子view稚疹,該子view需要在適配器中增加對(duì)應(yīng)的點(diǎn)擊事件居灯,然后在activity中增加setOnItemChildClickListener方法添加點(diǎn)擊事件。三内狗,添加點(diǎn)擊事件的時(shí)候需要區(qū)分是哪個(gè)條目怪嫌,title條目時(shí)候?yàn)門(mén)estAdapter.TYPE_LEVEL_0,message條目的時(shí)候?yàn)門(mén)estAdapter.TYPE_LEVEL_1柳沙。在對(duì)應(yīng)的條目中岩灭,分別調(diào)用我寫(xiě)的TODO中的方法來(lái)獲取數(shù)據(jù)÷咐穑可用于展示噪径。
package com.mumu.jsrecyclerview6;
import android.os.Bundle;
import android.support.annotation.NonNull;
import android.support.v7.app.AppCompatActivity;
import android.support.v7.widget.LinearLayoutManager;
import android.support.v7.widget.RecyclerView;
import android.util.Log;
import android.view.View;
import android.widget.Toast;
import com.chad.library.adapter.base.BaseQuickAdapter;
import com.chad.library.adapter.base.entity.MultiItemEntity;
import com.chad.library.adapter.base.listener.OnItemChildClickListener;
import com.scwang.smartrefresh.layout.SmartRefreshLayout;
import com.scwang.smartrefresh.layout.api.RefreshLayout;
import com.scwang.smartrefresh.layout.listener.OnRefreshLoadMoreListener;
import java.util.ArrayList;
import java.util.List;
import butterknife.BindView;
import butterknife.ButterKnife;
/**
* @author : zlf
* date : 2019/4/16
* github : https://github.com/mamumu
* blog : http://www.reibang.com/u/281e9668a5a6
*/
public class MainActivity extends AppCompatActivity {
@BindView(R.id.rv_test)
RecyclerView rvTest;
@BindView(R.id.srl_test)
SmartRefreshLayout srlTest;
private TestAdapter mTestAdapter;
private ArrayList<TestEntity.ResultBean> mResult = new ArrayList<>();
private ArrayList<MultiItemEntity> mList = new ArrayList<>();
@Override
protected void onCreate(Bundle savedInstanceState) {
super.onCreate(savedInstanceState);
setContentView(R.layout.activity_main);
ButterKnife.bind(this);
initData();
initView();
}
private void initData() {
for (int i = 0; i < 2; i++) {
TestEntity.ResultBean resultBean = new TestEntity.ResultBean();
resultBean.setTitle1("小狗" + i);
resultBean.setTitle2("小貓" + i);
List<TestEntity.ResultBean.ListBean> list = new ArrayList<>();
for (int j = 0; j < 5; j++) {
TestEntity.ResultBean.ListBean listBean = new TestEntity.ResultBean.ListBean();
listBean.setMessage1("小小小狗" + j);
listBean.setMessage2("小小小貓" + j);
list.add(listBean);
}
resultBean.setList(list);
resultBean.setSubItems(list);
mResult.add(resultBean);
mList.add(resultBean);
}
}
private void initView() {
refreshView();
smartRefreshView();
}
/**
* 刷新消息列表
*/
private void refreshView() {
//1,加載空布局文件柱恤,便于第五步適配器在沒(méi)有數(shù)據(jù)的時(shí)候加載
View emptyView = View.inflate(this, R.layout.empty_view, null);
//2,設(shè)置LayoutManager,LinearLayoutManager表示豎直向下
rvTest.setLayoutManager(new LinearLayoutManager(this));
//3找爱,初始化一個(gè)無(wú)數(shù)據(jù)的適配器
mTestAdapter = new TestAdapter(null);
//4梗顺,綁定recyclerView和適配器
//5,動(dòng)畫(huà)加載车摄,默認(rèn)關(guān)閉
// mTestAdapter.openLoadAnimation(BaseQuickAdapter.SLIDEIN_RIGHT);
rvTest.setAdapter(mTestAdapter);
//6寺谤,給recyclerView設(shè)置空布局
mTestAdapter.setEmptyView(emptyView);
//7,展開(kāi)所以
// mTestAdapter.expandAll();
mTestAdapter.setOnItemChildClickListener(new BaseQuickAdapter.OnItemChildClickListener() {
@Override
public void onItemChildClick(BaseQuickAdapter adapter, View view, int position) {
Log.d("aaa", position + "");
switch (adapter.getItemViewType(position)) {
case TestAdapter.TYPE_LEVEL_0:
// TODO: 2019/4/16 關(guān)鍵代碼,獲取數(shù)據(jù)源(頭部的)
TestEntity.ResultBean resultBean = (TestEntity.ResultBean) mList.get(position);
switch (view.getId()) {
case R.id.item_title1:
Toast.makeText(MainActivity.this, resultBean.getTitle1(),
Toast.LENGTH_SHORT).show();
break;
case R.id.item_title2:
Toast.makeText(MainActivity.this, resultBean.getTitle2(),
Toast.LENGTH_SHORT).show();
break;
}
break;
case TestAdapter.TYPE_LEVEL_1:
// TODO: 2019/4/16 關(guān)鍵代碼练般,獲取數(shù)據(jù)源(子列表的)
TestEntity.ResultBean.ListBean listBean = (TestEntity.ResultBean.ListBean) mList.get(position);
switch (view.getId()) {
case R.id.item_message1:
Toast.makeText(MainActivity.this, listBean.getMessage1(),
Toast.LENGTH_SHORT).show();
break;
case R.id.item_message2:
Toast.makeText(MainActivity.this, listBean.getMessage2(),
Toast.LENGTH_SHORT).show();
break;
}
break;
}
}
});
}
/**
* MainActivity中增加下拉刷新和上拉加載的監(jiān)聽(tīng)方法
*/
private void smartRefreshView() {
srlTest.setOnRefreshLoadMoreListener(new OnRefreshLoadMoreListener() {
@Override
public void onRefresh(@NonNull RefreshLayout refreshLayout) {
//下拉刷新,一般添加調(diào)用接口獲取數(shù)據(jù)的方法
getData(2);
//結(jié)束下拉刷新
refreshLayout.finishRefresh();
}
@Override
public void onLoadMore(@NonNull RefreshLayout refreshLayout) {
//上拉加載矗漾,一般添加調(diào)用接口獲取更多數(shù)據(jù)的方法
getData(3);
//結(jié)束上拉加載,展示沒(méi)有更多數(shù)據(jù)
// refreshLayout.finishLoadMoreWithNoMoreData();
//結(jié)束上拉加載
refreshLayout.finishLoadMore();
}
});
}
/**
* 獲取數(shù)據(jù)的方法
* 該方法純屬展示各種效果薄料,實(shí)際應(yīng)用時(shí)候請(qǐng)自己根據(jù)需求做判斷即可
*
* @param mode 模式:1為剛開(kāi)始進(jìn)來(lái)加載數(shù)據(jù) 空數(shù)據(jù) 2為下拉刷新 3為上拉加載
*/
private void getData(int mode) {
//添加臨時(shí)數(shù)據(jù)敞贡,一般直接從接口獲取
switch (mode) {
case 1:
break;
case 2:
mList.clear();
initData();
//更新數(shù)據(jù)
mTestAdapter.setNewData(mList);
break;
case 3:
initData();
//更新數(shù)據(jù)
mTestAdapter.setNewData(mList);
break;
}
}
}
- 如果后臺(tái)返回的數(shù)據(jù),則對(duì)應(yīng)的遍歷方法如下摄职,
public ArrayList<MultiItemEntity> getData(List<TestEntity.ResultBean> resultBeanList) {
ArrayList<MultiItemEntity> res = new ArrayList<>();
for (int i = 0; i < resultBeanList.size(); i++) {
TestEntity.ResultBean resultBean = resultBeanList.get(i);
for (int j = 0; j < resultBean.getList().size(); j++) {
resultBean.addSubItem(resultBean.getList().get(j));
}
res.add(resultBean);
}
return res;
}
- 調(diào)用方法如下誊役,取代initDate()方法。
mList.addAll(getData(testEntity.getResult()));
4谷市,對(duì)應(yīng)的適配器的代碼如下蛔垢。注意點(diǎn):一,extends BaseMultiItemQuickAdapter<MultiItemEntity, BaseViewHolder>為固定寫(xiě)法迫悠,實(shí)現(xiàn)方法即可鹏漆。二,構(gòu)造器中增加布局對(duì)應(yīng)關(guān)系创泄。三艺玲,給子view增加點(diǎn)擊事件需要增加TODO中代碼。
package com.mumu.jsrecyclerview6;
import android.support.annotation.NonNull;
import android.view.View;
import android.widget.AdapterView;
import android.widget.Toast;
import com.chad.library.adapter.base.BaseMultiItemQuickAdapter;
import com.chad.library.adapter.base.BaseViewHolder;
import com.chad.library.adapter.base.entity.MultiItemEntity;
import java.util.ArrayList;
import java.util.List;
/**
* @author : zlf
* date : 2019/4/16
* github : https://github.com/mamumu
* blog : http://www.reibang.com/u/281e9668a5a6
*/
public class TestAdapter extends BaseMultiItemQuickAdapter<MultiItemEntity, BaseViewHolder> {
public static final int TYPE_LEVEL_0 = 0;
public static final int TYPE_LEVEL_1 = 1;
/**
* Same as QuickAdapter#QuickAdapter(Context,int) but with
* some initialization data.
*
* @param data A new list is created out of this one to avoid mutable list
*/
public TestAdapter(List<MultiItemEntity> data) {
super(data);
addItemType(TYPE_LEVEL_0, R.layout.item_title);
addItemType(TYPE_LEVEL_1, R.layout.item_message);
}
@NonNull
@Override
public List<MultiItemEntity> getData() {
return super.getData();
}
@Override
protected void convert(final BaseViewHolder holder, final MultiItemEntity item) {
switch (holder.getItemViewType()) {
case TYPE_LEVEL_0:
final TestEntity.ResultBean resultBean = (TestEntity.ResultBean) item;
holder.setText(R.id.item_title1, resultBean.getTitle1());
holder.setText(R.id.item_title2, resultBean.getTitle2());
// TODO: 2019/4/16 關(guān)鍵代碼鞠抑,添加子view的點(diǎn)擊事件
holder.addOnClickListener(R.id.item_title1);
holder.addOnClickListener(R.id.item_title2);
//添加該條目的點(diǎn)擊事件
holder.itemView.setOnClickListener(new View.OnClickListener() {
@Override
public void onClick(View v) {
int pos = holder.getAdapterPosition();
if (resultBean.isExpanded()) {
collapse(pos, false);
Toast.makeText(mContext, "收起:" + resultBean.getTitle1(),
Toast.LENGTH_SHORT).show();
} else {
expand(pos, false);
Toast.makeText(mContext, "展開(kāi):" + resultBean.getTitle1(),
Toast.LENGTH_SHORT).show();
}
}
});
break;
case TYPE_LEVEL_1:
final TestEntity.ResultBean.ListBean listBean = (TestEntity.ResultBean.ListBean) item;
holder.setText(R.id.item_message1, listBean.getMessage1());
holder.setText(R.id.item_message2, listBean.getMessage2());
// TODO: 2019/4/16 關(guān)鍵代碼饭聚,添加子view的點(diǎn)擊事件
holder.addOnClickListener(R.id.item_message1);
holder.addOnClickListener(R.id.item_message2);
//添加該條目的點(diǎn)擊事件
holder.itemView.setOnClickListener(new View.OnClickListener() {
@Override
public void onClick(View view) {
Toast.makeText(mContext, "點(diǎn)擊了:" + listBean.getMessage1() + listBean.getMessage2(),
Toast.LENGTH_SHORT).show();
}
});
break;
}
}
}
5,對(duì)應(yīng)的后臺(tái)返回?cái)?shù)據(jù)對(duì)應(yīng)的實(shí)體類(lèi)搁拙。注意點(diǎn):一秒梳,該實(shí)體類(lèi)其實(shí)返回的是兩個(gè)嵌套的列表集合,外層列表集合為ResultBean箕速,ResultBean 繼承為固定寫(xiě)法(extends AbstractExpandableItem<ResultBean.ListBean> implements MultiItemEntity)酪碘,泛型中為內(nèi)層的列表集合。二盐茎,內(nèi)層列表集合為L(zhǎng)istBean婆跑,只需要實(shí)現(xiàn)implements MultiItemEntity即可。然后分別實(shí)現(xiàn)對(duì)應(yīng)的方法庭呜。三滑进,該實(shí)體類(lèi)只需要GsonFormot生成,然后更改以上1募谎,二點(diǎn)即可扶关。
package com.mumu.jsrecyclerview6;
import com.chad.library.adapter.base.entity.AbstractExpandableItem;
import com.chad.library.adapter.base.entity.MultiItemEntity;
import java.io.Serializable;
import java.util.List;
/**
* @author : zlf
* date : 2019/4/16
* github : https://github.com/mamumu
* blog : http://www.reibang.com/u/281e9668a5a6
*/
public class TestEntity implements Serializable {
/**
* Result : [{"title1":"我有一只小狗1","title2":"我有一只小狗2","list":[{"message1":"我有一只小狗我有一只小狗我有一只小狗我有一只小狗1","message2":"我有一只小狗我有一只小狗我有一只小狗我有一只小狗2"},{"message1":"我有一只小狗我有一只小狗我有一只小狗我有一只小狗1","message2":"我有一只小狗我有一只小狗我有一只小狗我有一只小狗2"}]},{"title1":"我有一只小狗1","title2":"我有一只小狗2","list":[{"message1":"我有一只小狗我有一只小狗我有一只小狗我有一只小狗1","message2":"我有一只小狗我有一只小狗我有一只小狗我有一只小狗2"},{"message1":"我有一只小狗我有一只小狗我有一只小狗我有一只小狗1","message2":"我有一只小狗我有一只小狗我有一只小狗我有一只小狗2"}]}]
* Success : true
* StatusCode : 200
*/
private boolean Success;
private int StatusCode;
private List<ResultBean> Result;
public boolean isSuccess() {
return Success;
}
public void setSuccess(boolean Success) {
this.Success = Success;
}
public int getStatusCode() {
return StatusCode;
}
public void setStatusCode(int StatusCode) {
this.StatusCode = StatusCode;
}
public List<ResultBean> getResult() {
return Result;
}
public void setResult(List<ResultBean> Result) {
this.Result = Result;
}
public static class ResultBean extends AbstractExpandableItem<ResultBean.ListBean> implements MultiItemEntity {
/**
* title1 : 我有一只小狗1
* title2 : 我有一只小狗2
* list : [{"message1":"我有一只小狗我有一只小狗我有一只小狗我有一只小狗1","message2":"我有一只小狗我有一只小狗我有一只小狗我有一只小狗2"},{"message1":"我有一只小狗我有一只小狗我有一只小狗我有一只小狗1","message2":"我有一只小狗我有一只小狗我有一只小狗我有一只小狗2"}]
*/
private String title1;
private String title2;
private List<ListBean> list;
public String getTitle1() {
return title1;
}
public void setTitle1(String title1) {
this.title1 = title1;
}
public String getTitle2() {
return title2;
}
public void setTitle2(String title2) {
this.title2 = title2;
}
public List<ListBean> getList() {
return list;
}
public void setList(List<ListBean> list) {
this.list = list;
}
@Override
public int getLevel() {
return 0;
}
@Override
public int getItemType() {
return TestAdapter.TYPE_LEVEL_0;
}
@Override
public void setSubItems(List<ListBean> list) {
super.setSubItems(list);
}
public static class ListBean implements MultiItemEntity {
/**
* message1 : 我有一只小狗我有一只小狗我有一只小狗我有一只小狗1
* message2 : 我有一只小狗我有一只小狗我有一只小狗我有一只小狗2
*/
private String message1;
private String message2;
public String getMessage1() {
return message1;
}
public void setMessage1(String message1) {
this.message1 = message1;
}
public String getMessage2() {
return message2;
}
public void setMessage2(String message2) {
this.message2 = message2;
}
@Override
public int getItemType() {
return TestAdapter.TYPE_LEVEL_1;
}
}
}
}
6,對(duì)應(yīng)的幾個(gè)布局文件如下数冬。
- activity_main.xml
<?xml version="1.0" encoding="utf-8"?>
<LinearLayout 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:orientation="vertical"
tools:context=".MainActivity">
<com.scwang.smartrefresh.layout.SmartRefreshLayout
android:id="@+id/srl_test"
android:layout_width="match_parent"
android:layout_height="match_parent"
app:srlEnablePreviewInEditMode="true"
app:srlPrimaryColor="#00000000">
<com.scwang.smartrefresh.layout.header.ClassicsHeader
android:layout_width="match_parent"
android:layout_height="wrap_content"
app:srlAccentColor="@color/colorPrimary" />
<android.support.v7.widget.RecyclerView
android:id="@+id/rv_test"
android:layout_width="match_parent"
android:layout_height="match_parent">
</android.support.v7.widget.RecyclerView>
<com.scwang.smartrefresh.layout.footer.ClassicsFooter
android:layout_width="match_parent"
android:layout_height="wrap_content"
app:srlAccentColor="@color/colorPrimary" />
</com.scwang.smartrefresh.layout.SmartRefreshLayout>
</LinearLayout>
- empty_view.xml
<?xml version="1.0" encoding="utf-8"?>
<LinearLayout xmlns:android="http://schemas.android.com/apk/res/android"
android:id="@+id/ll_bg"
android:layout_width="match_parent"
android:layout_height="match_parent"
android:background="#F6F7F9"
android:gravity="center"
android:orientation="vertical">
<ImageView
android:id="@+id/iv_empty"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:background="@mipmap/ic_launcher" />
<TextView
android:id="@+id/tv_empty"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:layout_marginTop="20dp"
android:text="暫無(wú)數(shù)據(jù)"
android:textColor="#999999"
android:textSize="13sp" />
</LinearLayout>
- item_title.xml
<?xml version="1.0" encoding="utf-8"?>
<RelativeLayout xmlns:android="http://schemas.android.com/apk/res/android"
android:layout_width="match_parent"
android:layout_height="50dp"
android:background="#FFFFFF">
<TextView
android:id="@+id/item_title1"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:layout_centerVertical="true"
android:layout_marginLeft="15dp"
android:background="#00aaff"
android:paddingTop="10dp"
android:paddingBottom="10dp"
android:text="我有一只小狗1"
android:textColor="@color/colorAccent"
android:textSize="16sp" />
<TextView
android:id="@+id/item_title2"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:layout_alignParentRight="true"
android:layout_centerVertical="true"
android:layout_marginLeft="20dp"
android:layout_marginRight="15dp"
android:background="#00aaff"
android:paddingTop="10dp"
android:paddingBottom="10dp"
android:text="我有一只小狗2"
android:textColor="@color/colorAccent"
android:textSize="16sp" />
<View
android:layout_width="match_parent"
android:layout_height="1dp"
android:layout_alignParentBottom="true"
android:background="#000000" />
</RelativeLayout>
- item_message.xml
<?xml version="1.0" encoding="utf-8"?>
<LinearLayout xmlns:android="http://schemas.android.com/apk/res/android"
android:layout_width="match_parent"
android:layout_height="wrap_content"
android:background="#6ffff6"
android:gravity="center"
android:orientation="vertical">
<TextView
android:id="@+id/item_message1"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:padding="5dp"
android:layout_marginTop="5dp"
android:layout_marginBottom="5dp"
android:background="#ffffff"
android:ellipsize="end"
android:maxLines="2"
android:text="小小小狗"
android:textColor="#000000"
android:textSize="14sp" />
<TextView
android:id="@+id/item_message2"
android:layout_width="wrap_content"
android:padding="5dp"
android:layout_height="wrap_content"
android:layout_marginTop="5dp"
android:layout_marginBottom="5dp"
android:background="#ffffff"
android:ellipsize="end"
android:maxLines="2"
android:text="小小小貓"
android:textColor="#000000"
android:textSize="14sp" />
<View
android:layout_width="match_parent"
android:layout_height="1dp"
android:background="#ffffff" />
</LinearLayout>
7节槐,對(duì)應(yīng)github地址
demo地址:https://github.com/mamumu/jsRecyclerView6
10,本系列第一篇文章地址拐纱,如果本文看不懂可以看第一篇铜异,如有其它疑問(wèn)請(qǐng)留言。
地址:http://www.reibang.com/p/ce972355c71d
如果有發(fā)現(xiàn)錯(cuò)誤歡迎指正我及時(shí)修改秸架,如果有好的建議歡迎留言揍庄。如果覺(jué)得對(duì)你有幫助歡迎給小星星,謝謝东抹。