本文整理汇总了Java中android.widget.PopupMenu.OnMenuItemClickListener方法的典型用法代码示例。如果您正苦于以下问题:Java PopupMenu.OnMenuItemClickListener方法的具体用法?Java PopupMenu.OnMenuItemClickListener怎么用?Java PopupMenu.OnMenuItemClickListener使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类android.widget.PopupMenu
的用法示例。
在下文中一共展示了PopupMenu.OnMenuItemClickListener方法的2个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的Java代码示例。
示例1: setActionWhenItemMenuClicked
import android.widget.PopupMenu; //导入方法依赖的package包/类
public void setActionWhenItemMenuClicked(PopupMenu.OnMenuItemClickListener newAction) {
actionWhenItemMenuClicked = newAction;
}
示例2: bind
import android.widget.PopupMenu; //导入方法依赖的package包/类
public void bind(Token token, int menu, PopupMenu.OnMenuItemClickListener micl) {
mCodes = null;
// Setup menu.
mPopupMenu.getMenu().clear();
mPopupMenu.getMenuInflater().inflate(menu, mPopupMenu.getMenu());
mPopupMenu.setOnMenuItemClickListener(micl);
// Cancel all active animations.
setEnabled(true);
removeCallbacks(this);
mImage.clearAnimation();
mProgressInner.clearAnimation();
mProgressOuter.clearAnimation();
mProgressInner.setVisibility(View.GONE);
mProgressOuter.setVisibility(View.GONE);
// Get the code placeholder.
char[] placeholder = new char[token.getDigits()];
for (int i = 0; i < placeholder.length; i++)
placeholder[i] = '-';
mPlaceholder = new String(placeholder);
// Show the image.
Picasso.with(getContext())
.load(token.getImage())
.placeholder(R.mipmap.ic_freeotp_logo_foreground)
.fit()
.into(mImage);
// Set the labels.
mLabel.setText(token.getLabel());
mIssuer.setText(token.getIssuer());
mCode.setText(mPlaceholder);
if (mIssuer.getText().length() == 0) {
mIssuer.setText(token.getLabel());
mLabel.setVisibility(View.GONE);
} else {
mLabel.setVisibility(View.VISIBLE);
}
}