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


Java BaseViewHolder.setImageResource方法代码示例

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


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

示例1: convert

import com.chad.library.adapter.base.BaseViewHolder; //导入方法依赖的package包/类
@Override
protected void convert(BaseViewHolder helper, Status item) {
    switch (helper.getLayoutPosition() %
            3) {
        case 0:
            helper.setImageResource(R.id.img, R.mipmap.animation_img1);
            break;
        case 1:
            helper.setImageResource(R.id.img, R.mipmap.animation_img2);
            break;
        case 2:
            helper.setImageResource(R.id.img, R.mipmap.animation_img3);
            break;
    }
    helper.setText(R.id.tweetName, "Hoteis in Rio de Janeiro");
    helper.setText(R.id.tweetText, "O ever youthful,O ever weeping");

}
 
开发者ID:weiwenqiang,项目名称:GitHub,代码行数:19,代码来源:QuickAdapter.java

示例2: convert

import com.chad.library.adapter.base.BaseViewHolder; //导入方法依赖的package包/类
@Override
protected void convert(BaseViewHolder helper, Status item) {
    switch (helper.getLayoutPosition()%
            3){
        case 0:
            helper.setImageResource(R.id.img,R.mipmap.animation_img1);
            break;
        case 1:
            helper.setImageResource(R.id.img,R.mipmap.animation_img2);
            break;
        case 2:
            helper.setImageResource(R.id.img,R.mipmap.animation_img3);
            break;
    }
    helper.setText(R.id.tweetName,"Hoteis in Rio de Janeiro");
    String msg="\"He was one of Australia's most of distinguished artistes, renowned for his portraits\"";
    ( (TextView)helper.getView(R.id.tweetText)).setText(SpannableStringUtils.getBuilder(msg).append("landscapes and nedes").setClickSpan(clickableSpan).create());
    ( (TextView)helper.getView(R.id.tweetText)).setMovementMethod(LinkMovementMethod.getInstance());
}
 
开发者ID:weiwenqiang,项目名称:GitHub,代码行数:20,代码来源:PullToRefreshAdapter.java

示例3: convert

import com.chad.library.adapter.base.BaseViewHolder; //导入方法依赖的package包/类
@Override
protected void convert(BaseViewHolder helper, General item) {
    if (item.getImagePath() != null) {
        //Log.d("TAG", "position:" + position + "&&" + "notnull" + general.getName());
        String path=item.getImagePath();
        Bitmap bitmap = BitmapFactory.decodeFile(path);
        helper.setImageBitmap(R.id.search_general_image, bitmap);
    } else if (item.getImageRes() != 0) {
        helper.setImageResource(R.id.search_general_image, item.getImageRes());
    }
    else {
        helper.setImageResource(R.id.search_general_image, R.drawable.circle);
    }
    if (item.getConcerned() > 0) {
        //Toast.makeText(mContext, "ok", Toast.LENGTH_SHORT).show();
        helper.setImageResource(R.id.search_concerned, R.drawable.star_on);
    }
    helper.setText(R.id.search_name, item.getName());
    //helper.setImageResource(R.id.search_concerned, 0);
    helper.itemView.setTag(item.getid());
}
 
开发者ID:wmgylc,项目名称:The-Three-kingdoms-Generals-Dictionary,代码行数:22,代码来源:SearchAdapter.java

示例4: convert

import com.chad.library.adapter.base.BaseViewHolder; //导入方法依赖的package包/类
@Override
protected void convert(BaseViewHolder helper, String item) {
    switch (helper.getLayoutPosition() %
            3) {
        case 0:
            helper.setImageResource(R.id.iv_head, R.mipmap.head_img0);
            break;
        case 1:
            helper.setImageResource(R.id.iv_head, R.mipmap.head_img1);
            break;
        case 2:
            helper.setImageResource(R.id.iv_head, R.mipmap.head_img2);
            break;
    }
    helper.setText(R.id.tv, item);
}
 
开发者ID:weiwenqiang,项目名称:GitHub,代码行数:17,代码来源:ItemDragAdapter.java

示例5: 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

示例6: convert

import com.chad.library.adapter.base.BaseViewHolder; //导入方法依赖的package包/类
@Override
protected void convert(BaseViewHolder helper, Status item) {
    switch (helper.getLayoutPosition()%
            3){
        case 0:
            helper.setImageResource(R.id.iv,R.mipmap.animation_img1);
            break;
        case 1:
            helper.setImageResource(R.id.iv,R.mipmap.animation_img2);
            break;
        case 2:
            helper.setImageResource(R.id.iv,R.mipmap.animation_img3);
            break;
    }
}
 
开发者ID:weiwenqiang,项目名称:GitHub,代码行数:16,代码来源:HeaderAndFooterAdapter.java

示例7: renderEntity4

import com.chad.library.adapter.base.BaseViewHolder; //导入方法依赖的package包/类
private void renderEntity4(BaseViewHolder helper, ItemEntity4 item) {
    helper.setImageResource(R.id.item_4_icon, item.getImg());
    helper.setText(R.id.item_4_title, item.getTitle());
    helper.setText(R.id.item_4_name, item.getName());
    helper.setText(R.id.item_4_des, item.getDes());
    helper.setText(R.id.item_4_tag, item.getTag());
    helper.setText(R.id.item_4_people, item.getPeople());
    helper.setText(R.id.item_4_price, item.getPrice());
}
 
开发者ID:crazysunj,项目名称:MultiTypeRecyclerViewAdapter,代码行数:10,代码来源:MyAdapter.java

示例8: initTypeImage

import com.chad.library.adapter.base.BaseViewHolder; //导入方法依赖的package包/类
private void initTypeImage(BaseViewHolder helper, GankIoCustomItemBean item) {
    switch (item.getType()) {
        case "福利":
            helper.setImageResource(R.id.iv_type_item_title, R.drawable
                    .ic_vector_title_welfare);
            break;
        case "Android":
            helper.setImageResource(R.id.iv_type_item_title, R.drawable
                    .ic_vector_title_android);
            break;
        case "iOS":
            helper.setImageResource(R.id.iv_type_item_title, R.drawable.ic_vector_title_ios);
            break;
        case "前端":
            helper.setImageResource(R.id.iv_type_item_title, R.drawable.ic_vector_title_front);
            break;
        case "休息视频":
            helper.setImageResource(R.id.iv_type_item_title, R.drawable.ic_vector_title_video);
            break;
        case "瞎推荐":
            helper.setImageResource(R.id.iv_type_item_title, R.drawable.ic_vector_item_tuijian);
            break;
        case "拓展资源":
            helper.setImageResource(R.id.iv_type_item_title, R.drawable.ic_vector_item_tuozhan);
            break;
        case "App":
            helper.setImageResource(R.id.iv_type_item_title, R.drawable.ic_vector_item_app);
            break;
    }
}
 
开发者ID:Horrarndoo,项目名称:YiZhi,代码行数:31,代码来源:GankIoCustomAdapter.java

示例9: convert

import com.chad.library.adapter.base.BaseViewHolder; //导入方法依赖的package包/类
@Override
protected void convert(BaseViewHolder helper, ItemEntity4 item) {
    helper.setImageResource(R.id.item_4_icon, item.getImg());
    helper.setText(R.id.item_4_title, item.getTitle());
    helper.setText(R.id.item_4_name, item.getName());
    helper.setText(R.id.item_4_des, item.getDes());
    helper.setText(R.id.item_4_tag, item.getTag());
    helper.setText(R.id.item_4_people, item.getPeople());
    helper.setText(R.id.item_4_price, item.getPrice());
}
 
开发者ID:crazysunj,项目名称:MultiTypeRecyclerViewAdapter,代码行数:11,代码来源:Type3Adapter.java

示例10: renderHeaderFourth

import com.chad.library.adapter.base.BaseViewHolder; //导入方法依赖的package包/类
private void renderHeaderFourth(BaseViewHolder helper, HeaderFourthItem item) {
    helper.setText(R.id.item_header_name, item.getName());
    helper.setImageResource(R.id.item_header_img, R.mipmap.ic_launcher);
}
 
开发者ID:crazysunj,项目名称:MultiTypeRecyclerViewAdapter,代码行数:5,代码来源:RxAptHelperAdapter.java

示例11: renderFourth

import com.chad.library.adapter.base.BaseViewHolder; //导入方法依赖的package包/类
private void renderFourth(BaseViewHolder helper, FourthItem item) {
    helper.setText(R.id.item_name, item.getName());
    helper.setImageResource(R.id.item_img, item.getImg());
}
 
开发者ID:crazysunj,项目名称:MultiTypeRecyclerViewAdapter,代码行数:5,代码来源:SimpleRxHelperAdapter.java

示例12: renderHeaderSecond

import com.chad.library.adapter.base.BaseViewHolder; //导入方法依赖的package包/类
private void renderHeaderSecond(BaseViewHolder helper, HeaderSecondItem item) {
    helper.setText(R.id.item_header_name, item.getName());
    helper.setImageResource(R.id.item_header_img, R.mipmap.ic_launcher);

}
 
开发者ID:crazysunj,项目名称:MultiTypeRecyclerViewAdapter,代码行数:6,代码来源:SimpleRxHelperAdapter.java

示例13: renderSecond

import com.chad.library.adapter.base.BaseViewHolder; //导入方法依赖的package包/类
private void renderSecond(BaseViewHolder helper, SecondItem item) {
    helper.setText(R.id.item_name, item.getName());
    helper.setImageResource(R.id.item_img, item.getImg());
}
 
开发者ID:weiwenqiang,项目名称:GitHub,代码行数:5,代码来源:ErrorAndrEmptyHelperAdapter.java

示例14: renderThird

import com.chad.library.adapter.base.BaseViewHolder; //导入方法依赖的package包/类
private void renderThird(BaseViewHolder helper, ThirdItem item) {
    helper.setText(R.id.item_name, item.getName());
    helper.setImageResource(R.id.item_img, item.getImg());
}
 
开发者ID:weiwenqiang,项目名称:GitHub,代码行数:5,代码来源:RxAptHelperAdapter.java

示例15: convert

import com.chad.library.adapter.base.BaseViewHolder; //导入方法依赖的package包/类
@Override
protected void convert(BaseViewHolder helper, HomeItem item) {
    helper.setText(R.id.text, item.getTitle());
    helper.setImageResource(R.id.icon, item.getImageResource());
}
 
开发者ID:weiwenqiang,项目名称:GitHub,代码行数:6,代码来源:HomeAdapter.java


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