本文整理汇总了Java中android.support.v7.internal.widget.ListPopupWindow类的典型用法代码示例。如果您正苦于以下问题:Java ListPopupWindow类的具体用法?Java ListPopupWindow怎么用?Java ListPopupWindow使用的例子?那么, 这里精选的类代码示例或许可以为您提供帮助。
ListPopupWindow类属于android.support.v7.internal.widget包,在下文中一共展示了ListPopupWindow类的2个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的Java代码示例。
示例1: showMoreOptionMenu
import android.support.v7.internal.widget.ListPopupWindow; //导入依赖的package包/类
private void showMoreOptionMenu(View view) {
mMenuWindow = new ListPopupWindow(getActivity());
mMenuWindow.setModal(true);
mMenuWindow.setContentWidth(getResources().getDimensionPixelSize(
R.dimen.popo_menu_dialog_width));
mMenuWindow.setAdapter(mMenuAdapter);
mMenuWindow.setOnItemClickListener(this);
mMenuWindow.setAnchorView(view);
mMenuWindow.show();
}
示例2: tryShow
import android.support.v7.internal.widget.ListPopupWindow; //导入依赖的package包/类
public boolean tryShow() {
mPopup = new ListPopupWindow(mContext, null, R.attr.popupMenuStyle);
mPopup.setOnDismissListener(this);
mPopup.setOnItemClickListener(this);
mAdapter = new MenuAdapter(mMenu);
mPopup.setAdapter(mAdapter);
mPopup.setModal(true);
View anchor = mAnchorView;
if (anchor != null) {
final boolean addGlobalListener = mTreeObserver == null;
mTreeObserver = anchor.getViewTreeObserver(); // Refresh to latest
if (addGlobalListener) {
mTreeObserver.addOnGlobalLayoutListener(this);
}
mPopup.setAnchorView(anchor);
} else {
return false;
}
mPopup.setContentWidth(Math.min(measureContentWidth(mAdapter), mPopupMaxWidth));
mPopup.setInputMethodMode(PopupWindow.INPUT_METHOD_NOT_NEEDED);
mPopup.show();
mPopup.getListView().setOnKeyListener(this);
return true;
}