本文整理汇总了Java中com.chad.library.adapter.base.BaseViewHolder.setText方法的典型用法代码示例。如果您正苦于以下问题:Java BaseViewHolder.setText方法的具体用法?Java BaseViewHolder.setText怎么用?Java BaseViewHolder.setText使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类com.chad.library.adapter.base.BaseViewHolder
的用法示例。
在下文中一共展示了BaseViewHolder.setText方法的15个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的Java代码示例。
示例1: convert
import com.chad.library.adapter.base.BaseViewHolder; //导入方法依赖的package包/类
@Override
protected void convert(BaseViewHolder helper, Status item) {
helper.addOnClickListener(R.id.img).addOnClickListener(R.id.tweetName);
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(ClickableMovementMethod.getInstance());
((TextView) helper.getView(R.id.tweetText)).setFocusable(false);
((TextView) helper.getView(R.id.tweetText)).setClickable(false);
((TextView) helper.getView(R.id.tweetText)).setLongClickable(false);
}
示例2: showBigImg
import com.chad.library.adapter.base.BaseViewHolder; //导入方法依赖的package包/类
private void showBigImg(BaseViewHolder helper, News item) {
//中间大图布局,判断是否有视频
TextView tvBottomRight = helper.getView(R.id.id_info_tv);
if (item.has_video) {
helper.setVisible(R.id.id_play_iv, true);//显示播放按钮
tvBottomRight.setCompoundDrawables(null, null, null, null);//去除TextView左侧图标
helper.setText(R.id.id_info_tv, item.video_duration + "");//设置时长
GlideApp.with(mContext)
.load(item.video_detail_info.detail_video_large_image.url)
.into((ImageView) helper.getView(R.id.id_iv));
} else {
helper.setVisible(R.id.id_play_iv, false);//隐藏播放按钮
tvBottomRight.setCompoundDrawables(ResouceUtil.getDrawable(R.drawable.icon_picture_group), null, null, null);//TextView增加左侧图标
helper.setText(R.id.id_info_tv, item.gallary_image_count + " 图");//设置时长
GlideApp.with(mContext).load(item.image_list.get(0).url.replace("list/300x196", "large")).centerCrop()
.into((ImageView) helper.getView(R.id.id_iv));//中间图片使用image_list第一张
}
}
示例3: convert
import com.chad.library.adapter.base.BaseViewHolder; //导入方法依赖的package包/类
@Override
protected void convert(BaseViewHolder helper, WeixinChoiceItemBean item) {
if (DBUtils.getDB(mContext).isRead(DBConfig.TABLE_WEIXIN, item.getId(), ItemState
.STATE_IS_READ)) {
helper.setTextColor(R.id.tv_item_title, Color.GRAY);
} else {
if (SpUtils.getNightModel(mContext)) {
helper.setTextColor(R.id.tv_item_title, Color.WHITE);
} else {
helper.setTextColor(R.id.tv_item_title, Color.BLACK);
}
}
helper.setText(R.id.tv_item_title, item.getTitle());
helper.setText(R.id.tv_item_who, item.getSource());
Glide.with(mContext).load(item.getFirstImg()).crossFade().into((ImageView) helper.getView(R
.id.iv_item_image));
}
示例4: convert
import com.chad.library.adapter.base.BaseViewHolder; //导入方法依赖的package包/类
@Override
protected void convert(final BaseViewHolder helper, GankTypeInfo item) {
if (selectType && helper.getLayoutPosition() < 3){
helper.setBackgroundRes(R.id.tv_channel_value, R.drawable.shape_channel_grey);
}else{
helper.setBackgroundRes(R.id.tv_channel_value, R.drawable.ripple_item_bg_border);
}
helper.setText(R.id.tv_channel_value, item.getKey());
if (mItemTouchHelperCallback != null) {
helper.itemView.setOnTouchListener(new View.OnTouchListener() {
@Override
public boolean onTouch(View v, MotionEvent event) {
// 触摸事件发生的时候,如果是定死频道,直接不给拖拽
if (helper.getLayoutPosition() < 3) {
mItemTouchHelperCallback.setLongPressDragEnabled(false);
return true;
} else {
mItemTouchHelperCallback.setLongPressDragEnabled(true);
}
return false;
}
});
}
}
示例5: convert
import com.chad.library.adapter.base.BaseViewHolder; //导入方法依赖的package包/类
@Override
protected void convert(BaseViewHolder helper, Status item) {
helper.addOnClickListener(R.id.tweetText);
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());
}
示例6: convert
import com.chad.library.adapter.base.BaseViewHolder; //导入方法依赖的package包/类
@Override
protected void convert(final BaseViewHolder helper, final NewsListBean.NewsBean item) {
if (helper.getPosition() % 2 == 0) {
DensityUtil.setViewMargin(helper.itemView, false, 0, 0, 0, 40);
} else {
DensityUtil.setViewMargin(helper.itemView, false, 5, 0, 0, 40);
}
helper.setText(R.id.tv_item_top_news,item.getTitle());
GlideUtils.loadImage(3,item.getImgsrc(), (ImageView) helper.getView(R.id.iv_item_top_news));
helper.itemView.setOnClickListener(new View.OnClickListener() {
@Override
public void onClick(View v) {
onItemClickListener.onItemClickListener(item.getDocid(), item.getImgsrc(),helper.getView(R.id.iv_item_top_news));
}
});
}
示例7: convert
import com.chad.library.adapter.base.BaseViewHolder; //导入方法依赖的package包/类
@Override
protected void convert(BaseViewHolder helper, StateHEHE item) {
helper.addOnClickListener(R.id.name).addOnClickListener(R.id.password);
switch (helper.getLayoutPosition()%3){
case 0:
UiSizeUtil.LayoutChange(helper.getConvertView(),UiSizeUtil.NO_CHANGE,300);
break;
case 1:
UiSizeUtil.LayoutChange(helper.getConvertView(),UiSizeUtil.NO_CHANGE,300);
break;
case 2:
UiSizeUtil.LayoutChange(helper.getConvertView(),UiSizeUtil.NO_CHANGE,200);
break;
}
helper.setText(R.id.name,"啥玩意1");
helper.setText(R.id.password,"啥玩意2");
}
示例8: convert
import com.chad.library.adapter.base.BaseViewHolder; //导入方法依赖的package包/类
@Override
protected void convert(BaseViewHolder holder, final BusLineNearby.StationBean item) {
holder.setText(R.id.tv_line_name, item.getSName() + " " + item.getSname_info());
holder.setText(R.id.tv_line_desc, item.getLines_info());
holder.setText(R.id.tv_line_direction, "");
holder.itemView.setOnClickListener(new View.OnClickListener() {
@Override
public void onClick(View view) {
StationDetailActivity.start(mContext, item.getSName(), item.getSCode());
}
});
}
示例9: convert
import com.chad.library.adapter.base.BaseViewHolder; //导入方法依赖的package包/类
@Override
protected void convert(BaseViewHolder helper, GankIoCustomItemBean item) {
initTypeImage(helper, item);
helper.setText(R.id.tv_item_who, StringUtils.isEmpty(item.getWho()) ? "佚名" : item
.getWho());
helper.setText(R.id.tv_item_type, item.getType());
helper.setText(R.id.tv_item_time, item.getCreatedAt().substring(0, 10));
switch (helper.getItemViewType()) {
case GankIoCustomItemBean.GANK_IO_DAY_ITEM_CUSTOM_NORMAL:
helper.setText(R.id.tv_item_title, item.getDesc());
initTitleColor(helper, item);
if (item.getImages() != null) {
if (item.getImages().size() > 0 && !TextUtils.isEmpty(item.getImages().get(0)))
Glide.with(mContext).load(item.getImages().get(0) + mImageSize)
.asBitmap()
.into((ImageView) helper.getView(R.id.iv_item_image));
}
break;
case GankIoCustomItemBean.GANK_IO_DAY_ITEM_CUSTOM_IMAGE:
Glide.with(mContext)
.load(item.getUrl())
.asBitmap()
.centerCrop()
.placeholder(R.mipmap.img_default_meizi)
.into((ImageView) helper.getView(R.id.iv_item_image));
break;
case GankIoCustomItemBean.GANK_IO_DAY_ITEM_CUSTOM_NO_IMAGE:
helper.setText(R.id.tv_item_title, item.getDesc());
initTitleColor(helper, item);
break;
default:
break;
}
}
示例10: convert
import com.chad.library.adapter.base.BaseViewHolder; //导入方法依赖的package包/类
@Override
protected void convert(BaseViewHolder helper, ActivityItem item) {
helper.setText(R.id.tv_fragment_near_item_activity_name, item.getActivityName());
helper.setText(R.id.tv_fragment_near_item_distance, mContext.getResources().getString(R.string.activity_distance,item.getDistance()));
helper.setText(R.id.tv_fragment_near_item_price, mContext.getResources().getString(R.string.activity_cost,item.getCost()));
helper.setText(R.id.tv_fragment_near_enroll_number, mContext.getResources().getString(R.string.enroll_number,item.getEnrollNumber()));
ImageView imageView = helper.getView(R.id.iv_fragment_near_item_pic);
GlideApp.with(mContext)
.load(RestConstants.IMAGE_ROOT_URL+item.getImageUrl().replace("\\","/"))
.placeholder(R.drawable.activity_default_pic)
.error(R.drawable.activity_default_pic)
.into(imageView);
}
示例11: renderHeader
import com.chad.library.adapter.base.BaseViewHolder; //导入方法依赖的package包/类
private void renderHeader(BaseViewHolder helper, CommonHeaderEntity item) {
final int type = item.getItemType() + RecyclerViewAdapterHelper.HEADER_TYPE_DIFFER;
helper.setText(R.id.header_title, item.getTitle());
TextView optionsView = helper.getView(R.id.header_options);
final String options = item.getOptions();
optionsView.setText(options);
optionsView.setTextColor(HomeAdapterHelper.getColor(type));
optionsView.setOnClickListener(v -> {
if (mOnHeaderClickListener != null) {
mOnHeaderClickListener.onHeaderClick(type, options);
}
});
}
示例12: convert
import com.chad.library.adapter.base.BaseViewHolder; //导入方法依赖的package包/类
@Override
protected void convert(BaseViewHolder helper, ImageItem item) {
//获取ImageView,并显示图片到ImageView上
ImageView iv_pano = helper.getView(R.id.iv_pano);
Context context = helper.getConvertView().getContext();
Glide.with(context).load(item.url).into(iv_pano);
//设置标题到TextView上
helper.setText(R.id.tv_title, item.title);
View main = helper.getView(R.id.ll_item_main);
main.setTag(item);
main.setOnClickListener(listener);
}
示例13: renderGankioHeader
import com.chad.library.adapter.base.BaseViewHolder; //导入方法依赖的package包/类
private void renderGankioHeader(BaseViewHolder helper, CommonHeaderEntity item) {
final int type = item.getItemType() + RecyclerViewAdapterHelper.HEADER_TYPE_DIFFER;
helper.setText(R.id.header_title, item.getTitle());
TextView optionsView = helper.getView(R.id.header_options);
final String options = item.getOptions();
optionsView.setText(options);
optionsView.setTextColor(HomeAdapterHelper.getColor(type));
optionsView.setOnClickListener(v -> {
if (mOnHeaderClickListener != null) {
mOnHeaderClickListener.onHeaderClick(type, options);
}
});
}
示例14: setLinearGroupStyle
import com.chad.library.adapter.base.BaseViewHolder; //导入方法依赖的package包/类
/**
* 设置线性布局时的分组的格式
*
* @describe
*/
private void setLinearGroupStyle(BaseViewHolder helper, long time) {
long nowTime = TimeUtils.getNowMills();
if (DateUtils.isInSameYear(nowTime, time)) { // 如果同一年 显示为:x月
helper.setText(R.id.tv_note_list_linear_month, TimeUtils.millis2String(time, new SimpleDateFormat("MM月")));
} else { //否则 显示为:xxxx年x月
helper.setText(R.id.tv_note_list_linear_month, TimeUtils.millis2String(time, new SimpleDateFormat("yyyy年MM月")));
}
}
示例15: 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);
}