本文整理汇总了Java中com.chad.library.adapter.base.BaseViewHolder.getView方法的典型用法代码示例。如果您正苦于以下问题:Java BaseViewHolder.getView方法的具体用法?Java BaseViewHolder.getView怎么用?Java BaseViewHolder.getView使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类com.chad.library.adapter.base.BaseViewHolder
的用法示例。
在下文中一共展示了BaseViewHolder.getView方法的15个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的Java代码示例。
示例1: renderFooter
import com.chad.library.adapter.base.BaseViewHolder; //导入方法依赖的package包/类
private void renderFooter(BaseViewHolder helper, final FooterOCEntity item) {
final int type = item.getItemType() + RecyclerViewAdapterHelper.FOOTER_TYPE_DIFFER;
final TextView footer = helper.getView(R.id.item_footer);
String text = String.format("我是底 title:%s flag:%s type:%s", item.getTitle(), item.getFlag(), type);
Log.d("FooterOCEntity", "footer: " + text);
footer.setText(text);
footer.setOnClickListener(new View.OnClickListener() {
@Override
public void onClick(View v) {
if (mOnFooterClickListener != null) {
if (Constants.EXPAND.equals(item.getTitle())) {
mOnFooterClickListener.onFooterClick(type, false);
item.setTitle(Constants.FOLD);
} else {
mOnFooterClickListener.onFooterClick(type, true);
item.setTitle(Constants.EXPAND);
}
footer.setText(String.format("我是底 title:%s flag:%s type:%s", item.getTitle(), item.getFlag(), type));
}
}
});
}
示例2: convert
import com.chad.library.adapter.base.BaseViewHolder; //导入方法依赖的package包/类
@Override
protected void convert(final BaseViewHolder helper, FakeWeather.FakeForecastHourly item) {
int width = SizeUtils.getScreenWidth(mContext) / 5;
RecyclerView.LayoutParams params = (RecyclerView.LayoutParams) helper.itemView.getLayoutParams();
params.width = width;
helper.itemView.setLayoutParams(params);
helper.setText(R.id.tv_hourly_temp, item.getTemp() + "°");
helper.setText(R.id.tv_hourly_time, item.getTime());
final ImageView imageView = helper.getView(R.id.iv_hourly_weather);
WeatherUtil.getInstance().getWeatherDict(item.getCode()).observeOn(AndroidSchedulers.mainThread()).subscribe(new SimpleSubscriber<WeatherBean>() {
@Override
public void onNext(WeatherBean weatherBean) {
Glide.with(mContext).load(weatherBean.getIcon()).diskCacheStrategy(DiskCacheStrategy.ALL).into(imageView);
}
});
}
示例3: convert
import com.chad.library.adapter.base.BaseViewHolder; //导入方法依赖的package包/类
@Override
protected void convert(BaseViewHolder helper, VideoItem item) {
helper.setText(R.id.topic_init_title,item.title);
helper.setText(R.id.date_text,new SimpleDateFormat("MM/dd/yyyy").format(item.date));
ImageView topicImg=helper.getView(R.id.topic_init_img);
Glide.with(helper.getConvertView().getContext()).load(item.img).into(topicImg);
String[] tags = item.tags;
for (int i = 0; i < tags.length; i++) {
helper.setText(ids[i],tags[i]);
}
View main = helper.getView(R.id.video_layout);
main.setTag(item);
main.setOnClickListener(listener);
}
示例4: convert
import com.chad.library.adapter.base.BaseViewHolder; //导入方法依赖的package包/类
@Override
protected void convert(final BaseViewHolder helper, final SectionChildListBean.StoriesBean item) {
if (item.getImages()!=null&&item.getImages().size()>0){
GlideUtils.load(mContext,item.getImages().get(0), (ImageView) helper.getView(R.id.iv_theme_item_image));
}
TextView tvThemeItemTitle= helper.getView(R.id.tv_theme_item_title);
tvThemeItemTitle.setText(item.getTitle());
helper.itemView.setOnClickListener(new View.OnClickListener() {
@Override
public void onClick(View v) {
if (onItemClick!=null){
onItemClick.onItemClick(item.getId(),helper.getView(R.id.iv_theme_item_image));
}
}
});
}
示例5: showLineraLayoutGroup
import com.chad.library.adapter.base.BaseViewHolder; //导入方法依赖的package包/类
/**
* 显示是否线性布局时的分组信息
*
* @param helper
* @param isShow 是否显示
* @param time 时间戳
* @describe
*/
private void showLineraLayoutGroup(boolean isShow, BaseViewHolder helper, long time) {
// 有分组的列,marginTop为8dp,否则,为0dp
LinearLayout ll = helper.getView(R.id.ll_note_list_linear);
LinearLayout.LayoutParams params = (LinearLayout.LayoutParams) ll.getLayoutParams();
if (isShow) {
helper.setVisible(R.id.tv_note_list_linear_month, true);
setLinearGroupStyle(helper, time);
params.setMargins(SizeUtils.dp2px(0), SizeUtils.dp2px(8), SizeUtils.dp2px(0), SizeUtils.dp2px(0));
ll.setLayoutParams(params);
} else {
helper.setVisible(R.id.tv_note_list_linear_month, false);
params.setMargins(SizeUtils.dp2px(0), SizeUtils.dp2px(0), SizeUtils.dp2px(0), SizeUtils.dp2px(0));
ll.setLayoutParams(params);
}
}
示例6: convert
import com.chad.library.adapter.base.BaseViewHolder; //导入方法依赖的package包/类
@Override
protected void convert(BaseViewHolder helper, ListBean item) {
switch (helper.getItemViewType()) {
case ListItemType.ITEM_NORMAL:
helper.setText(R.id.tv_arrow_text, item.getText());
helper.setText(R.id.tv_arrow_value, item.getValue());
break;
case ListItemType.ITEM_AVATAR:
Glide.with(mContext)
.load(item.getImageUrl())
.diskCacheStrategy(DiskCacheStrategy.ALL).centerCrop().dontAnimate()
.into((ImageView) helper.getView(R.id.img_arrow_avatar));
break;
case ListItemType.ITEM_SWITCH:
helper.setText(R.id.tv_arrow_switch_text,item.getText());
final SwitchCompat switchCompat = helper.getView(R.id.list_item_switch);
switchCompat.setChecked(true);
switchCompat.setOnCheckedChangeListener(item.getOnCheckedChangeListener());
break;
}
}
示例7: convert
import com.chad.library.adapter.base.BaseViewHolder; //导入方法依赖的package包/类
@Override
protected void convert(BaseViewHolder helper, ReplySection item) {
ImageView img = helper.getView(R.id.iv_pic);
AppComponent mAppComponent = ((App)img.getContext().getApplicationContext())
.getAppComponent();
if (item.t.getData().getUser()!=null){
mAppComponent.imageLoader().loadImage(img.getContext(),
ImageConfigImpl
.builder()
.transformation(new GlideCircleTransform())
.url(item.t.getData().getUser().getAvatar())
.imageView(img)
.build());
}
DateFormat df = new SimpleDateFormat("yyyy/MM/dd");
if (item.t.getData().getUser()!=null){
helper.setText(R.id.tv_nickname,item.t.getData().getUser().getNickname());
}
helper.setText(R.id.tv_comment,item.t.getData().getMessage())
.setText(R.id.tv_good_num,item.t.getData().getLikeCount()+"")
.setText(R.id.tv_reply_time,df.format(item.t.getData().getCreateTime()));
}
示例8: convert
import com.chad.library.adapter.base.BaseViewHolder; //导入方法依赖的package包/类
@Override
protected void convert(final BaseViewHolder helper, final NBAListBean.NBABean item) {
ImageView ivAndroidPic = helper.getView(R.id.iv_android_pic);
// 显示gif图片会很耗内存
if (item.getImgsrc() != null
&& !TextUtils.isEmpty(item.getImgsrc())) {
ivAndroidPic.setVisibility(View.VISIBLE);
GlideUtils.loadMovieTopImg(ivAndroidPic, item.getImgsrc());
} else {
ivAndroidPic.setVisibility(View.GONE);
}
helper.setText(R.id.tv_android_des, item.getTitle());
helper.setText(R.id.tv_android_who, item.getEname());
helper.setText(R.id.tv_android_time, TimeUtil.getTime(item.getPtime()));
helper.itemView.setOnClickListener(new View.OnClickListener() {
@Override
public void onClick(View v) {
onItemClickListener.onItemClickListener(item.getDocid(), item.getImgsrc(),helper.getView(R.id.iv_android_pic));
}
});
}
示例9: convert
import com.chad.library.adapter.base.BaseViewHolder; //导入方法依赖的package包/类
@Override
protected void convert(final BaseViewHolder helper, final ClickEntity item) {
switch (helper.getItemViewType()) {
case ClickEntity.CLICK_ITEM_VIEW:
helper.addOnClickListener(R.id.btn);
break;
case ClickEntity.CLICK_ITEM_CHILD_VIEW:
helper.addOnClickListener(R.id.iv_num_reduce).addOnClickListener(R.id.iv_num_add)
.addOnLongClickListener(R.id.iv_num_reduce).addOnLongClickListener(R.id.iv_num_add);
// set img data
break;
case ClickEntity.LONG_CLICK_ITEM_VIEW:
helper.addOnLongClickListener(R.id.btn);
break;
case ClickEntity.LONG_CLICK_ITEM_CHILD_VIEW:
helper.addOnLongClickListener(R.id.iv_num_reduce).addOnLongClickListener(R.id.iv_num_add)
.addOnClickListener(R.id.iv_num_reduce).addOnClickListener(R.id.iv_num_add);
break;
case ClickEntity.NEST_CLICK_ITEM_CHILD_VIEW:
helper.setNestView(R.id.item_click); // u can set nestview id
final RecyclerView recyclerView = helper.getView(R.id.nest_list);
recyclerView.setLayoutManager(new LinearLayoutManager(helper.itemView.getContext(), LinearLayoutManager.VERTICAL, false));
recyclerView.setHasFixedSize(true);
nestAdapter = new NestAdapter();
nestAdapter.setOnItemClickListener(this);
nestAdapter.setOnItemChildClickListener(this);
recyclerView.setAdapter(nestAdapter);
break;
}
}
示例10: convert
import com.chad.library.adapter.base.BaseViewHolder; //导入方法依赖的package包/类
@Override
protected void convert(BaseViewHolder helper, String item) {
helper.setText(R.id.tv_history_item, item);
helper.setTextColor(R.id.tv_history_item, historyTextColor);
ImageView iconImageView = helper.getView(R.id.right_icon);
iconImageView.setImageResource(historyIcon);
}
示例11: convert
import com.chad.library.adapter.base.BaseViewHolder; //导入方法依赖的package包/类
@Override
protected void convert(BaseViewHolder helper, Category item) {
AppComponent mAppComponent = ((App)helper.getView(R.id.iv_bg).getContext().getApplicationContext())
.getAppComponent();
ImageView bg = helper.getView(R.id.iv_bg);
helper.setText(R.id.tv_name,item.getName());
mAppComponent.imageLoader().loadImage(bg.getContext(),
ImageConfigImpl
.builder()
.url(item.getBgPicture())
.imageView(bg)
.build());
}
示例12: convert
import com.chad.library.adapter.base.BaseViewHolder; //导入方法依赖的package包/类
@Override
protected void convert(BaseViewHolder baseViewHolder, ItemBean itemBean) {
ZKImageView imageView = baseViewHolder.getView(R.id.pic_img);
int width = ScreenUtils.getScreenWidth() / 2;
ViewGroup.LayoutParams params = imageView.getLayoutParams();
params.width = width;
if(randomHeight.containsKey(itemBean.getId())){
params.height = randomHeight.get(itemBean.getId());
}
imageView.setLayoutParams(params);
ImageLoader.loadImage(imageView, itemBean.getPicTinyUrl());
}
示例13: 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);
}
});
}
示例14: convert
import com.chad.library.adapter.base.BaseViewHolder; //导入方法依赖的package包/类
@Override
protected void convert(BaseViewHolder holder, Note note) {
RelativeLayout gridItem = holder.getView(R.id.grid_item);
ViewGroup.LayoutParams layoutParams = gridItem.getLayoutParams();
layoutParams.width = ScreenUtil.getScreenDispaly(mContext)[0] / 2;
layoutParams.height = ScreenUtil.getScreenDispaly(mContext)[0] / 2;
gridItem.setLayoutParams(layoutParams);
holder.addOnClickListener(R.id.cardview).addOnLongClickListener(R.id.cardview);
TextView content = holder.getView(R.id.content);
TextView time = holder.getView(R.id.time);
ImageView thumbnail = holder.getView(R.id.thumbnail_iv);
content.setText(note.getContent());
if (StringUtils.isNotEmpty(note.getContent())) {
if (note.getContent().length() > 20) {
//TODO 字数多了换成两行显示,字体缩小。
//this.content.setText(note.getContent());
}
}
time.setText(mContext.getString(R.string.note_log_text, mContext.getString(R.string.create),
TimeUtils.getTime(note.getCreateTime())));
Logger.INSTANCE.e("" + note.getImagePath());
if (StringUtils.isEmpty(note.getImagePath()) || "[]".equals(note.getImagePath())) {
thumbnail.setVisibility(View.INVISIBLE);
content.setTextColor(mContext.getResources().getColor(R.color.gray));
time.setTextColor(mContext.getResources().getColor(R.color.gray));
} else {
thumbnail.setVisibility(View.VISIBLE);
content.setTextColor(mContext.getResources().getColor(R.color.white));
time.setTextColor(mContext.getResources().getColor(R.color.white));
ImageUtils.INSTANCE.showThumbnail(mContext, note.getImagePath(), thumbnail);
}
}
示例15: convert
import com.chad.library.adapter.base.BaseViewHolder; //导入方法依赖的package包/类
@Override
protected void convert(BaseViewHolder baseViewHolder, VideoBean item) {
baseViewHolder.setText(R.id.tv_video_source, item.getTopicName());
baseViewHolder.setText(R.id.tv_video_playcount, item.getPlayCount() + "次播放");
ImageLoader.getInstance().withRound(mContext, item.getTopicImg(), (ImageView) baseViewHolder.getView(R.id.img_video_logo));
JCVideoPlayerStandard standard = baseViewHolder.getView(R.id.videoplayer);
standard.setUp(item.getMp4_url(), JCVideoPlayer.SCREEN_LAYOUT_LIST, item.getTitle());
ImageLoader.getInstance().with(mContext, item.getCover(), standard.thumbImageView);
}