本文整理汇总了Java中com.chad.library.adapter.base.BaseViewHolder.addOnLongClickListener方法的典型用法代码示例。如果您正苦于以下问题:Java BaseViewHolder.addOnLongClickListener方法的具体用法?Java BaseViewHolder.addOnLongClickListener怎么用?Java BaseViewHolder.addOnLongClickListener使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类com.chad.library.adapter.base.BaseViewHolder
的用法示例。
在下文中一共展示了BaseViewHolder.addOnLongClickListener方法的4个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的Java代码示例。
示例1: setGridLayout
import com.chad.library.adapter.base.BaseViewHolder; //导入方法依赖的package包/类
/**
* 设置网格布局
*
* @describe
*/
private void setGridLayout(BaseViewHolder helper, Note item) {
helper.addOnClickListener(R.id.cv_note_list_grid);
helper.addOnLongClickListener(R.id.cv_note_list_grid);
helper.setVisible(R.id.ll_note_list_linear, false);
helper.setVisible(R.id.cv_note_list_grid, true);
TextView tvContent=helper.getView(R.id.tv_note_list_grid_content);
if(isPrivacyAndRecycle(item))
helper.setText(R.id.tv_note_list_grid_content,Utils.getContext().getResources().getString(R.string.note_privacy_and_recycle));
else
parseTextContent(tvContent,item.getNoteContent());
// 设置便签的时间显示
setNoteTime(helper, item.getModifiedTime());
// 设置多选按钮
setCheckBox(helper);
}
示例2: setLinearLayout
import com.chad.library.adapter.base.BaseViewHolder; //导入方法依赖的package包/类
/**
* 设置线性布局
*
* @describe
*/
private void setLinearLayout(BaseViewHolder helper, Note item) {
helper.addOnClickListener(R.id.ll_note_list_line);
helper.addOnLongClickListener(R.id.ll_note_list_line);
// 显示竖排布局,隐藏网格布局
helper.setVisible(R.id.cv_note_list_grid, false);
helper.setVisible(R.id.ll_note_list_linear, true);
TextView tvContent=helper.getView(R.id.tv_note_list_linear_content);
if(isPrivacyAndRecycle(item))
helper.setText(R.id.tv_note_list_linear_content,Utils.getContext().getResources().getString(R.string.note_privacy_and_recycle));
else
parseTextContent(tvContent,item.getNoteContent());
// 设置便签的时间显示
setNoteTime(helper, item.getModifiedTime());
// 设置便签的分组显示
setLinearLayoutGroup(helper, item.getCreatedTime());
// 设置多选按钮
setCheckBox(helper);
}
示例3: 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;
}
}
示例4: convert
import com.chad.library.adapter.base.BaseViewHolder; //导入方法依赖的package包/类
@Override
protected void convert(BaseViewHolder holder, String item) {
ImageView image = holder.getView(R.id.iv_image);
holder.addOnClickListener(R.id.iv_image);
holder.addOnLongClickListener(R.id.iv_image);
setImage(item, image);
}