SummerHelper:SRecycleMoreAdapter
2018-10-25 本文已影响0人
西厌西厌
正常底部栏
1540453645(1).png自定义底部栏
1540453619(1).png @Override
protected void showBottomView(ViewGroup.LayoutParams params, boolean showBottom, BottomHolder hv) {
super.showBottomView(params, showBottom, hv);
if (tvFirstComment == null) {
tvFirstComment = new TextView(context);
hv.rlParent.addView(tvFirstComment);
}
RelativeLayout.LayoutParams contentParam = (RelativeLayout.LayoutParams) hv.tvNomore.getLayoutParams();
if (getRealItemCount() == 0) {
RelativeLayout.LayoutParams params1 = (RelativeLayout.LayoutParams) tvFirstComment.getLayoutParams();
params1.addRule(RelativeLayout.CENTER_HORIZONTAL);
params1.width = SUtils.getDip(context, 104);
params1.height = SUtils.getDip(context, 34);
params1.topMargin = SUtils.getDip(context, 20);
tvFirstComment.setBackgroundResource(R.drawable.so_white_greyeb_45);
tvFirstComment.setText("占领沙发");
tvFirstComment.setTextColor(getResourceColor(R.color.blue_56));
tvFirstComment.setGravity(Gravity.CENTER);
tvFirstComment.setVisibility(View.VISIBLE);
params.height = SUtils.getDip(context, 109);
final String content = "暂无评论,快去占领沙发吧!";
hv.tvNomore.setText(content);
contentParam.addRule(RelativeLayout.ALIGN_PARENT_BOTTOM);
contentParam.bottomMargin = SUtils.getDip(context, 5);
hv.tvNomore.setTextColor(getResourceColor(R.color.blue_b2));
hv.rlParent.setBackgroundColor(getResourceColor(R.color.white));
tvFirstComment.setOnClickListener(new View.OnClickListener() {
@Override
public void onClick(View v) {
if (context instanceof TopicDetailActivity) {
TopicDetailActivity activity = (TopicDetailActivity) context;
activity.showCommentDialog();
}
}
});
} else {
hv.tvNomore.setText("没有更多内容了");
hv.tvNomore.setGravity(Gravity.CENTER);
tvFirstComment.setVisibility(View.GONE);
params.height = SUtils.getDip(context, 50);
hv.tvNomore.setTextColor(getResourceColor(R.color.grey_93));
contentParam.addRule(RelativeLayout.CENTER_IN_PARENT);
contentParam.bottomMargin = SUtils.getDip(context, 0);
}
}