当前位置: 首页>>代码示例>>Java>>正文


Java BaseViewHolder.setImageDrawable方法代码示例

本文整理汇总了Java中com.chad.library.adapter.base.BaseViewHolder.setImageDrawable方法的典型用法代码示例。如果您正苦于以下问题:Java BaseViewHolder.setImageDrawable方法的具体用法?Java BaseViewHolder.setImageDrawable怎么用?Java BaseViewHolder.setImageDrawable使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在com.chad.library.adapter.base.BaseViewHolder的用法示例。


在下文中一共展示了BaseViewHolder.setImageDrawable方法的4个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的Java代码示例。

示例1: convert

import com.chad.library.adapter.base.BaseViewHolder; //导入方法依赖的package包/类
@Override
protected void convert(BaseViewHolder helper, VideoCommentListBean.DataBean.CommentsBean item) {
    helper.setText(R.id.tv_author_name, item.getNickName())
            .setText(R.id.tv_comment_content, item.getContent())
            .setText(R.id.tv_pub_time, item.getTime());

    if (item.getAvatarUrl().equals("")) {
        helper.setImageResource(R.id.civ_author, R.drawable.icon_default);
    } else {
        GlideManager.loadImage(mContext, item.getAvatarUrl(), (ImageView) helper.getView(R.id.civ_author));
    }
    helper.setImageDrawable(R.id.iv_user_level, UserUtils.getUserLevelLable(mContext, item.getUserLevel()));
    switch (helper.getItemViewType()) {
        case BaseConstant.TYPE_VIDEO_COMMENT_REPLY:
            helper.setText(R.id.tv_reply, String.format("回复%s:", item.getRef().getNickName()));
            ((TextView) helper.getView(R.id.tv_reply_content)).setText(item.getRef().getContent());
            break;
        case BaseConstant.TYPE_VIDEO_COMMENT_NO_REPLY:
            break;
    }
}
 
开发者ID:coderwjq,项目名称:ZhaZhaShop,代码行数:22,代码来源:VideoCommentAdapter.java

示例2: convert

import com.chad.library.adapter.base.BaseViewHolder; //导入方法依赖的package包/类
@Override
protected void convert(BaseViewHolder helper, MovieLongCommentBean.DataBean.FilmReviewsBean item) {
    helper.setText(R.id.tv_author_name, item.getAuthor().getNickName())
            .setText(R.id.tv_comment_title, item.getTitle())
            .setText(R.id.tv_comment_content, item.getText())
            .setText(R.id.tv_view_count, String.format("%s", item.getViewCount()))
            .setText(R.id.tv_comment_count, String.format("%s", item.getCommentCount()))
            .setText(R.id.tv_pub_time, TimeUtils.dateMD(item.getCreated()));

    Drawable icon = null;
    switch (item.getAuthor().getUserLevel()) {
        case 1:
            icon = mContext.getResources().getDrawable(R.drawable.ic_lv1, null);
            break;
        case 2:
            icon = mContext.getResources().getDrawable(R.drawable.ic_lv2, null);
            break;
        case 3:
            icon = mContext.getResources().getDrawable(R.drawable.ic_lv3, null);
            break;
        case 4:
            icon = mContext.getResources().getDrawable(R.drawable.ic_lv4, null);
            break;
        case 5:
            icon = mContext.getResources().getDrawable(R.drawable.ic_lv5, null);
            break;
    }
    helper.setImageDrawable(R.id.iv_user_level, icon);
    GlideManager.loadImage(mContext, item.getAuthor().getAvatarurl(), (CircleImageView) helper.getView(R.id.civ_author));
}
 
开发者ID:coderwjq,项目名称:ZhaZhaShop,代码行数:31,代码来源:MovieLongCommentAdapter.java

示例3: convert

import com.chad.library.adapter.base.BaseViewHolder; //导入方法依赖的package包/类
@Override
protected void convert(BaseViewHolder helper, General item) {
    //Log.d("TAG", "convert" + item.getName());
    helper.setText(R.id.name, item.getName())
            .setText(R.id.country, item.getCountry())
            .setText(R.id.info, item.getInfo());

    if (item.getConcerned() != 0) {
        helper.setImageResource(R.id.concerned, R.drawable.star_on);
    } else {
        helper.setImageDrawable(R.id.concerned, null);
    }

    //优先考虑主动设定的图片
    if (item.getImagePath() != null) {
        String path=item.getImagePath();
        Bitmap bitmap = BitmapFactory.decodeFile(path);
        helper.setImageBitmap(R.id.general_image, bitmap);
        //bitmap.recycle();
        if (bitmap == null) {
            //如果照片在本地被删除了
            helper.setImageResource(R.id.general_image, R.drawable.circle);
        }
    } else if (item.getImageRes() != 0){
        helper.setImageResource(R.id.general_image, item.getImageRes());
    } else {
        helper.setImageResource(R.id.general_image, R.drawable.circle);
    }
    //ItemView传递id值
    helper.itemView.setTag(item.getid());
    helper.itemView.setClickable(true);
}
 
开发者ID:wmgylc,项目名称:The-Three-kingdoms-Generals-Dictionary,代码行数:33,代码来源:GeneralAdapter.java

示例4: convert

import com.chad.library.adapter.base.BaseViewHolder; //导入方法依赖的package包/类
@Override
protected void convert(BaseViewHolder helper, MultipleItem item) {
    switch (helper.getItemViewType()) {
        case MultipleItem.TYPE_COUNT:
            helper.setText(R.id.my_favorites, item.mString1).addOnClickListener(R.id.my_favorites);
            helper.setText(R.id.my_bands, item.mString2).addOnClickListener(R.id.my_bands);
            break;
        case MultipleItem.TYPE_ORDER_HEADER:
            helper.addOnClickListener(R.id.ll_my_order);
            break;
        case MultipleItem.TYPE_ORDER:
            helper.setImageDrawable(R.id.my_order_image, ContextCompat.getDrawable(mContext, R.drawable.ic_launcher));
            helper.setText(R.id.my_order_name, item.mString1);
            if (item.isShow) {
                helper.getView(R.id.my_order_count).setVisibility(View.VISIBLE);
                if (item.count > 0) {
                    if (item.count < 99) {
                        helper.setText(R.id.my_order_count, String.valueOf(item.count));
                    } else {
                        helper.setText(R.id.my_order_count, String.valueOf("99+"));
                    }
                } else {
                    helper.getView(R.id.my_order_count).setVisibility(View.GONE);
                }
            } else {
                helper.getView(R.id.my_order_count).setVisibility(View.GONE);
            }
            break;
        case MultipleItem.TYPE_BALANCE:
            helper.setText(R.id.my_balance_text, item.mString1);
            helper.addOnClickListener(R.id.my_balance_btn);
            break;
        case MultipleItem.TYPE_TOOLS_HEADER:
            //helper.setText(R.id.tv_item_name, item.mString1);
            break;
        case MultipleItem.TYPE_TOOLS:
            helper.setImageDrawable(R.id.my_tools_image, ContextCompat.getDrawable(mContext, R.drawable.ic_launcher));
            helper.setText(R.id.my_tools_text, item.mString1);
            if (item.isShow) {
                helper.getView(R.id.my_tools_count).setVisibility(View.VISIBLE);
                if (item.count > 0) {
                    if (item.count < 99) {
                        helper.setText(R.id.my_tools_count, String.valueOf(item.count));
                    } else {
                        helper.setText(R.id.my_tools_count, String.valueOf("99+"));
                    }
                } else {
                    helper.getView(R.id.my_tools_count).setVisibility(View.GONE);
                }
            } else {
                helper.getView(R.id.my_tools_count).setVisibility(View.GONE);
            }
            break;
    }
}
 
开发者ID:yechaoa,项目名称:MultipleItemPage,代码行数:56,代码来源:MultipleItemQuickAdapter.java


注:本文中的com.chad.library.adapter.base.BaseViewHolder.setImageDrawable方法示例由纯净天空整理自Github/MSDocs等开源代码及文档管理平台,相关代码片段筛选自各路编程大神贡献的开源项目,源码版权归原作者所有,传播和使用请参考对应项目的License;未经允许,请勿转载。