美文网首页
SummerHelper:SRecycleMoreAdapter

SummerHelper:SRecycleMoreAdapter

作者: 西厌西厌 | 来源:发表于2018-10-25 16:01 被阅读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);
        }
    }

相关文章

网友评论

      本文标题:SummerHelper:SRecycleMoreAdapter

      本文链接:https://www.haomeiwen.com/subject/fekctqtx.html