本文整理汇总了Java中com.mcxtzhang.commonadapter.rv.ViewHolder类的典型用法代码示例。如果您正苦于以下问题:Java ViewHolder类的具体用法?Java ViewHolder怎么用?Java ViewHolder使用的例子?那么, 这里精选的类代码示例或许可以为您提供帮助。
ViewHolder类属于com.mcxtzhang.commonadapter.rv包,在下文中一共展示了ViewHolder类的8个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的Java代码示例。
示例1: onCreate
import com.mcxtzhang.commonadapter.rv.ViewHolder; //导入依赖的package包/类
@Override
protected void onCreate(Bundle savedInstanceState) {
super.onCreate(savedInstanceState);
setContentView(R.layout.activity_rv_single);
RecyclerView recyclerView = (RecyclerView) findViewById(R.id.activity_rv_single);
recyclerView.setLayoutManager(new LinearLayoutManager(this));
recyclerView.setAdapter(new CommonAdapter<TestBean>(this, mDatas = initDatas(), R.layout.item_test) {
@Override
public void convert(ViewHolder holder, TestBean testBean) {
Glide.with(RvSingleActivity.this)
.load(testBean.getAvatar())
.into((ImageView) holder.itemView.findViewById(R.id.ivAvatar));
((TextView) holder.itemView.findViewById(R.id.tvName)).setText(testBean.getName());
}
});
}
示例2: onCreateViewHolder
import com.mcxtzhang.commonadapter.rv.ViewHolder; //导入依赖的package包/类
@Override
public ViewHolder onCreateViewHolder(ViewGroup parent, int viewType) {
//add by zhangxutong 2016 08 05 begin ,for 点击事件为了兼容HeaderView FooterView 的Adapter
if (null == mRv) {
mRv = parent;
}
//add by zhangxutong 2016 08 05 end ,for 点击事件为了兼容HeaderView FooterView 的Adapter
return ViewHolder.get(mContext, parent, viewType);
}
示例3: onCreate
import com.mcxtzhang.commonadapter.rv.ViewHolder; //导入依赖的package包/类
@Override
protected void onCreate(Bundle savedInstanceState) {
super.onCreate(savedInstanceState);
setContentView(R.layout.activity_rv_header_mul_type);
RecyclerView recyclerView = (RecyclerView) findViewById(R.id.rv);
recyclerView.setLayoutManager(new LinearLayoutManager(this));
mDatas = initDatas();
mHeaderFooterAdapter = new HeaderFooterAdapter(new BaseMulTypeAdapter(this, mDatas) {
@Override
public void convert(ViewHolder holder, final IMulTypeHelper iMulTypeHelper) {
super.convert(holder, iMulTypeHelper);
switch (iMulTypeHelper.getItemLayoutId()) {
case R.layout.item_rv_mulbean_1:
holder.setOnClickListener(R.id.tv, new View.OnClickListener() {
@Override
public void onClick(View view) {
MulTypeMulBean1 mulTypeMulBean1 = (MulTypeMulBean1) iMulTypeHelper;
Toast.makeText(mContext, mulTypeMulBean1.getName(), Toast.LENGTH_SHORT).show();
}
});
break;
case R.layout.item_rv_mulbean_2:
holder.setOnClickListener(R.id.banner, new View.OnClickListener() {
@Override
public void onClick(View view) {
Toast.makeText(mContext, "你想调到哪里", Toast.LENGTH_SHORT).show();
}
});
break;
}
}
});
//1-0 同步静态数据,借助实体类
mHeaderFooterAdapter.setHeaderView(0, new HeaderBean("1-0 同步静态数据,借助实体类 点我跳转到多Type界面"));
recyclerView.setAdapter(mHeaderFooterAdapter);
}
示例4: onBind
import com.mcxtzhang.commonadapter.rv.ViewHolder; //导入依赖的package包/类
@Override
public void onBind(final ViewHolder holder) {
holder.setText(R.id.tv, text);
holder.setOnClickListener(R.id.tv, new View.OnClickListener() {
@Override
public void onClick(View v) {
//点击跳转到多ItemType
holder.itemView.getContext().startActivity(new Intent(holder.itemView.getContext(), RvMulTypeMulBeanActivity.class));
}
});
}
示例5: convert
import com.mcxtzhang.commonadapter.rv.ViewHolder; //导入依赖的package包/类
@Override
public void convert(ViewHolder holder, T t) {
t.onBind(holder);
}
示例6: onBind
import com.mcxtzhang.commonadapter.rv.ViewHolder; //导入依赖的package包/类
@Override
public void onBind(ViewHolder holder) {
Glide.with(holder.itemView.getContext()).load(background).into((ImageView) holder.getView(R.id.banner));
}
示例7: onBind
import com.mcxtzhang.commonadapter.rv.ViewHolder; //导入依赖的package包/类
@Override
public void onBind(ViewHolder holder) {
holder.setText(R.id.tv, name);
Glide.with(holder.itemView.getContext()).load(avatar).into((ImageView) holder.getView(R.id.iv1));
Glide.with(holder.itemView.getContext()).load(avatar).into((ImageView) holder.getView(R.id.iv2));
}
示例8: onBind
import com.mcxtzhang.commonadapter.rv.ViewHolder; //导入依赖的package包/类
void onBind(ViewHolder holder);