本文整理汇总了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");
}
示例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());
}
示例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());
}
示例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);
}
示例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);
}
示例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;
}
}
示例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());
}
示例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;
}
}
示例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());
}
示例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);
}
示例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());
}
示例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);
}
示例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());
}
示例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());
}
示例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());
}