本文整理匯總了Java中android.view.ActionMode.setCustomView方法的典型用法代碼示例。如果您正苦於以下問題:Java ActionMode.setCustomView方法的具體用法?Java ActionMode.setCustomView怎麽用?Java ActionMode.setCustomView使用的例子?那麽, 這裏精選的方法代碼示例或許可以為您提供幫助。您也可以進一步了解該方法所在類android.view.ActionMode
的用法示例。
在下文中一共展示了ActionMode.setCustomView方法的1個代碼示例,這些例子默認根據受歡迎程度排序。您可以為喜歡或者感覺有用的代碼點讚,您的評價將有助於係統推薦出更棒的Java代碼示例。
示例1: setActionMode
import android.view.ActionMode; //導入方法依賴的package包/類
private void setActionMode(final ActionMode mActionMode) {
this.mActionMode = mActionMode;
LayoutInflater inflator = (LayoutInflater) mActivity
.getSystemService(Context.LAYOUT_INFLATER_SERVICE);
View v = inflator.inflate(R.layout.action_mode_layout, null);
mActionMode.setCustomView(v);
mSelectTv = (TextView) v.findViewById(R.id.select_all_btn);
mMenuItemClickInterface.setTextView(mSelectTv);
mSelectTv.setOnClickListener(new View.OnClickListener() {
@Override
public void onClick(View view) {
PopupMenu popupMenu = new PopupMenu(mActivity, mSelectTv);
popupMenu.getMenuInflater().inflate(R.menu.pop_menu, popupMenu.getMenu());
popupMenu.setOnMenuItemClickListener(new PopupMenu.OnMenuItemClickListener() {
@Override
public boolean onMenuItemClick(MenuItem menuItem) {
if (menuItem.getItemId() == R.id.select_all) {
mMenuItemClickInterface.onAllItemSelect();
return true;
}
return false;
}
});
popupMenu.show();
}
});
}