本文整理汇总了Java中android.widget.PopupWindow.setOnDismissListener方法的典型用法代码示例。如果您正苦于以下问题:Java PopupWindow.setOnDismissListener方法的具体用法?Java PopupWindow.setOnDismissListener怎么用?Java PopupWindow.setOnDismissListener使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类android.widget.PopupWindow
的用法示例。
在下文中一共展示了PopupWindow.setOnDismissListener方法的11个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的Java代码示例。
示例1: apply
import android.widget.PopupWindow; //导入方法依赖的package包/类
/**
* 添加一些属性设置
* @param popupWindow
*/
private void apply(PopupWindow popupWindow){
popupWindow.setClippingEnabled(mClippEnable);
if(mIgnoreCheekPress){
popupWindow.setIgnoreCheekPress();
}
if(mInputMode!=-1){
popupWindow.setInputMethodMode(mInputMode);
}
if(mSoftInputMode!=-1){
popupWindow.setSoftInputMode(mSoftInputMode);
}
if(mOnDismissListener!=null){
popupWindow.setOnDismissListener(mOnDismissListener);
}
if(mOnTouchListener!=null){
popupWindow.setTouchInterceptor(mOnTouchListener);
}
popupWindow.setTouchable(mTouchable);
}
示例2: ListFilePopWindow
import android.widget.PopupWindow; //导入方法依赖的package包/类
public ListFilePopWindow(Context context, View targetView) {
super();
this.targetView = targetView;
View contentView = LayoutInflater.from(context).inflate(R.layout.kf5_list_file_dir, null);
listView = (ListView) contentView.findViewById(R.id.kf5_list_dir);
Point point = ScreenUtils.getScreenSize(context);
int height = (int) (point.y * (4.5f / 8.0f));
popupWindow = new PopupWindow();
popupWindow.setWidth(ViewGroup.LayoutParams.MATCH_PARENT);
popupWindow.setHeight(height);
popupWindow.setBackgroundDrawable(new BitmapDrawable());
popupWindow.setOutsideTouchable(true);
popupWindow.setFocusable(true);
popupWindow.setTouchable(true);
popupWindow.setOnDismissListener(new PopupWindow.OnDismissListener() {
@Override
public void onDismiss() {
// TODO Auto-generated method stub
popupWindow.dismiss();
}
});
popupWindow.setAnimationStyle(R.style.KF5FileListPopAnim);
popupWindow.setContentView(contentView);
listView.setOnItemClickListener(this);
}
示例3: show
import android.widget.PopupWindow; //导入方法依赖的package包/类
private void show() {
RecyclerView recyclerView = new RecyclerView(getContext());
recyclerView.setLayoutParams(new ViewGroup.LayoutParams(ViewGroup.LayoutParams.WRAP_CONTENT, ViewGroup.LayoutParams.WRAP_CONTENT));
recyclerView.setHasFixedSize(true);
recyclerView.setLayoutManager(new LinearLayoutManager(getContext(), LinearLayoutManager.VERTICAL, false));
recyclerView.setAdapter(adapter);
popupWindow = new PopupWindow(recyclerView, ViewGroup.LayoutParams.WRAP_CONTENT, ViewGroup.LayoutParams.WRAP_CONTENT);
popupWindow.setOutsideTouchable(true);
popupWindow.setFocusable(true);
popupWindow.showAsDropDown(this);
popupWindow.setOnDismissListener(new PopupWindow.OnDismissListener() {
@Override
public void onDismiss() {
if (onItemSelectedListener != null) {
onItemSelectedListener.onNothingSelected();
}
dismiss();
}
});
}
示例4: apply
import android.widget.PopupWindow; //导入方法依赖的package包/类
private void apply(PopupWindow mPopupWindow) {
mPopupWindow.setClippingEnabled(this.mClippEnable);
if(this.mIgnoreCheekPress) {
mPopupWindow.setIgnoreCheekPress();
}
if(this.mInputMode != -1) {
mPopupWindow.setInputMethodMode(this.mInputMode);
}
if(this.mSoftInputMode != -1) {
mPopupWindow.setSoftInputMode(this.mSoftInputMode);
}
if(this.mOnDismissListener != null) {
mPopupWindow.setOnDismissListener(this.mOnDismissListener);
}
if(this.mOnTouchListener != null) {
mPopupWindow.setTouchInterceptor(this.mOnTouchListener);
}
mPopupWindow.setTouchable(this.mTouchable);
}
示例5: PicPopupWindow
import android.widget.PopupWindow; //导入方法依赖的package包/类
private PicPopupWindow(Context context) {
mContext = context;
mInflater = (LayoutInflater) mContext
.getSystemService(Context.LAYOUT_INFLATER_SERVICE);
mPopupContent = (ViewGroup) mInflater.inflate(
R.layout.popup_window_list, null);
mPopupItemContent = (ViewGroup) mPopupContent
.findViewById(R.id.popup_window_item_content);
title = (TextView) mPopupContent
.findViewById(R.id.popup_window_title_text);
mPopupWindow = new PopupWindow(mPopupContent,
LayoutParams.MATCH_PARENT, LayoutParams.WRAP_CONTENT);
mPopupWindow.setFocusable(true);
mPopupWindow.setBackgroundDrawable(new BitmapDrawable());
mPopupWindow.setOnDismissListener(new OnDismissListener() {
@Override
public void onDismiss() {
// TODO Auto-generated method stub
resetItemByTag(setTag);
if (mAnimationListener != null) {
mAnimationListener.doAnimation(false);
}
}
});
mPopupWindow.setAnimationStyle(R.style.popup_window_animation);
}
示例6: initPopupWindow
import android.widget.PopupWindow; //导入方法依赖的package包/类
/**
* 初始化显示文件夹信息的popupWindow
*/
private void initPopupWindow() {
popRecyclerview = new RecyclerView(this);
popRecyclerview.setBackgroundColor(getResources().getColor(android.R.color.white));
LinearLayoutManager layoutManager = new LinearLayoutManager
(this, LinearLayoutManager.VERTICAL, false);
popRecyclerview.setLayoutManager(layoutManager);
popRecyclerview.addItemDecoration(new DividerItemDecoration(this, DividerItemDecoration.VERTICAL_LIST));
popRecyclerview.setPadding(0, Commonutil.dp2px(this, 5), 0, 0);
int screenHeight = getResources().getDisplayMetrics().heightPixels;
popupWindow = new PopupWindow(popRecyclerview, ViewGroup.LayoutParams.MATCH_PARENT,
(int) (screenHeight * 0.6f));
popupWindow.setBackgroundDrawable(new BitmapDrawable());
popupWindow.setFocusable(true);
popupWindow.setOutsideTouchable(false);
popupWindow.setAnimationStyle(R.style.popup_anim);
popupWindow.setOnDismissListener(new PopupWindow.OnDismissListener() {
@Override
public void onDismiss() {
fab.setVisibility(View.VISIBLE);
WindowManager.LayoutParams attributes =
ScanImagesActivity.this.getWindow().getAttributes();
attributes.alpha = 1;
ScanImagesActivity.this.getWindow().setAttributes(attributes);
}
});
}
示例7: showActionMenu
import android.widget.PopupWindow; //导入方法依赖的package包/类
/**
* 长按弹出菜单
*
* @param offsetY
* @param actionMenu
* @return 菜单创建成功,返回true
*/
private void showActionMenu(int offsetY, ActionMenu actionMenu) {
mActionMenuPopupWindow = new PopupWindow(actionMenu, WindowManager.LayoutParams.WRAP_CONTENT,
mActionMenuHeight, true);
mActionMenuPopupWindow.setFocusable(true);
mActionMenuPopupWindow.setOutsideTouchable(false);
mActionMenuPopupWindow.setBackgroundDrawable(new ColorDrawable(0x00000000));
mActionMenuPopupWindow.showAtLocation(this, Gravity.TOP | Gravity.CENTER_HORIZONTAL, 0, offsetY);
mActionMenuPopupWindow.setOnDismissListener(new PopupWindow.OnDismissListener() {
@Override
public void onDismiss() {
Selection.removeSelection(getEditableText());
// 如果设置了分散对齐,ActionMenu销毁后,强制刷新一次,防止出现文字背景未消失的情况
if (isTextJustify)
SelectableTextView.this.postInvalidate();
}
});
}
示例8: showActionMenu
import android.widget.PopupWindow; //导入方法依赖的package包/类
/**
* 长按弹出菜单
*
* @param offsetY
* @param actionMenu
* @return 菜单创建成功,返回true
*/
private void showActionMenu(int offsetY, ActionMenu actionMenu) {
mActionMenuPopupWindow = new PopupWindow(actionMenu, WindowManager.LayoutParams.WRAP_CONTENT,
mActionMenuHeight, true);
mActionMenuPopupWindow.setFocusable(true);
mActionMenuPopupWindow.setOutsideTouchable(false);
mActionMenuPopupWindow.setBackgroundDrawable(new ColorDrawable(0x00000000));
mActionMenuPopupWindow.showAtLocation(this, Gravity.TOP | Gravity.CENTER_HORIZONTAL, 0, offsetY);
mActionMenuPopupWindow.setOnDismissListener(new PopupWindow.OnDismissListener() {
@Override
public void onDismiss() {
// 清理已选的文字
clearSelectedTextBackground();
}
});
}
示例9: setPopWindow
import android.widget.PopupWindow; //导入方法依赖的package包/类
/**
* 获取弹出视图
*
* @return
*/
public void setPopWindow() {
ListView lv = new ListView(context);
LinearLayout.LayoutParams lp = new LinearLayout.LayoutParams(DensityUtil.dip2px(context, 150), ViewGroup.LayoutParams.WRAP_CONTENT);
lp.setMargins(15, 0, 15, 15);
lv.setLayoutParams(lp);
lv.setBackgroundColor(Color.WHITE);
if (Build.VERSION.SDK_INT >= Build.VERSION_CODES.LOLLIPOP) {
lv.setElevation(15);
}
lv.setAdapter(new IconAdapter());
lv.setOnItemClickListener(this);
LinearLayout ll = new LinearLayout(context);
ll.setLayoutParams(new ViewGroup.LayoutParams(DensityUtil.dip2px(context, 200), ViewGroup.LayoutParams.WRAP_CONTENT));
ll.addView(lv);
pop = new PopupWindow(ll, ViewGroup.LayoutParams.WRAP_CONTENT, ViewGroup.LayoutParams.WRAP_CONTENT, true);
pop.setTouchable(true);
pop.setOutsideTouchable(true);
//必须添加背景,否则点击空白无法自动隐藏
pop.setBackgroundDrawable(new BitmapDrawable());
pop.setOnDismissListener(new PopupWindow.OnDismissListener() {
@Override
public void onDismiss() {
if (changedListener != null) {
changedListener.onHide(FrmPopMenu.this);
}
}
});
}
示例10: initView
import android.widget.PopupWindow; //导入方法依赖的package包/类
/**
* 密码键盘默认样式
* @param context
*/
private void initView(Context context) {
mkeyboardLayout = new LinearLayout(context);
mkeyboardLayout.setOrientation(LinearLayout.VERTICAL);
if (null != mKeyBoardBgDrawable) {
mkeyboardLayout.setBackgroundDrawable(mKeyBoardBgDrawable);
} else {
mkeyboardLayout.setBackgroundColor(Color.GRAY);
}
LinearLayout.LayoutParams titleParams = new LinearLayout.LayoutParams(
LayoutParams.MATCH_PARENT, LayoutParams.WRAP_CONTENT);
titleParams.setMargins(0, 0, 0, 6);
mTitleLayout = new LinearLayout(context);
mTitleLayout.setGravity(Gravity.CENTER);
mTitleLayout.setOrientation(LinearLayout.HORIZONTAL);
mTitleLayout.setLayoutParams(titleParams);
int titleBackgroundColor = mContext.getResources()
.getColor(R.color.bg_security_keyboard_title);
mTitleLayout.setBackgroundColor(titleBackgroundColor);
mTitleView = new TextView(context);
mTitleView.setText("Secure Mode");
mTitleView.setTextColor(Color.WHITE);
mTitleView.setHeight(getSaftyKeyHeight() / 16);
mTitleView.setGravity(Gravity.CENTER);
mTitleLayout.addView(mTitleView);
mKeyBoardControl = new GrapeGridview(context);
mKeyBoardControl.setHorizontalScrollBarEnabled(false);
mKeyBoardControl.setVerticalScrollBarEnabled(false);
mKeyBoardControl.setEnabled(false);
mKeyBoardControl.setNumColumns(Constant.COLUMN_SOFT_KEYBOARD);
mKeyBoardControl.setVerticalSpacing(mMarginRow);
mKeyBoardControl.setHorizontalSpacing(mMarginCol);
mKeyBoardControl.setAdapter(mAdapter);
mkeyboardLayout.addView(mTitleLayout);
mkeyboardLayout.addView(mKeyBoardControl);
mkeyboardLayout.setPadding(mPaddingLeft, mPaddingTop, mPaddingRight,
mPaddingBottom);
mPopup = new PopupWindow(mkeyboardLayout, mWidth, mHeight);
mPopup.setBackgroundDrawable(new BitmapDrawable());
mPopup.setSoftInputMode(
WindowManager.LayoutParams.SOFT_INPUT_STATE_HIDDEN);
mPopup.setOutsideTouchable(true);
mPopup.setFocusable(true);
mPopup.setOnDismissListener(dismissListener);
}
示例11: init
import android.widget.PopupWindow; //导入方法依赖的package包/类
private void init() {
setupColors();
setupList();
mSearchEditText.setImeOptions(EditorInfo.IME_ACTION_DONE | EditorInfo.IME_FLAG_NO_EXTRACT_UI);
mStartSearchImageView.setOnClickListener(this);
mDoneSearchImageView.setOnClickListener(this);
mSearchEditText.addTextChangedListener(mTextWatcher);
mPopupWindow = new PopupWindow(mContext);
mPopupWindow.setContentView(mSpinnerListContainer);
mPopupWindow.setSoftInputMode(WindowManager.LayoutParams.SOFT_INPUT_ADJUST_PAN);
mPopupWindow.setInputMethodMode(PopupWindow.INPUT_METHOD_NEEDED);
mPopupWindow.setOnDismissListener(new PopupWindow.OnDismissListener() {
@Override
public void onDismiss() {
hideEdit();
}
});
mPopupWindow.setFocusable(false);
mPopupWindow.setElevation(DefaultElevation);
mPopupWindow.setBackgroundDrawable(ContextCompat.getDrawable(mContext, R.drawable.spinner_drawable));
mSpinnerListView.setOnItemClickListener(mOnItemSelectedListener);
if (mCurrSelectedView == null) {
if (!TextUtils.isEmpty(mSearchHintText)) {
mSearchEditText.setHint(mSearchHintText);
}
if (!TextUtils.isEmpty(mNoItemsFoundText)) {
mEmptyTextView.setText(mNoItemsFoundText);
}
if (mCurrSelectedView == null && !TextUtils.isEmpty(mRevealEmptyText)) {
TextView textView = new TextView(mContext);
textView.setText(mRevealEmptyText);
mCurrSelectedView = new SelectedView(textView, -1, 0);
mRevealItem.addView(textView);
}
} else {
mSpinnerListView.performItemClick(mCurrSelectedView.getView(), mCurrSelectedView.getPosition(), mCurrSelectedView.getId());
}
clearAnimation();
clearFocus();
}