本文整理匯總了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);
}