android.widget.PopupWindow.setOnDismissListener()方法的使用及代码示例

x33g5p2x  于2022-01-26 转载在 其他  
字(7.6k)|赞(0)|评价(0)|浏览(234)

本文整理了Java中android.widget.PopupWindow.setOnDismissListener()方法的一些代码示例,展示了PopupWindow.setOnDismissListener()的具体用法。这些代码示例主要来源于Github/Stackoverflow/Maven等平台,是从一些精选项目中提取出来的代码,具有较强的参考意义,能在一定程度帮忙到你。PopupWindow.setOnDismissListener()方法的具体详情如下:
包路径:android.widget.PopupWindow
类名称:PopupWindow
方法名:setOnDismissListener

PopupWindow.setOnDismissListener介绍

暂无

代码示例

代码示例来源:origin: aa112901/remusic

@Override
protected void onPreExecute() {
  super.onPreExecute();
  View view;
  if (popupWindow == null) {
    LayoutInflater layoutInflater = (LayoutInflater) mContext.getSystemService(Context.LAYOUT_INFLATER_SERVICE);
    view = layoutInflater.inflate(R.layout.loading_circle, null);
    popupWindow = new PopupWindow(view, 200, 220);
  }
  popupWindow.setFocusable(true);
  popupWindow.setOutsideTouchable(true);
  // 这个是为了点击“返回Back”也能使其消失,并且并不会影响你的背景
  popupWindow.setBackgroundDrawable(new BitmapDrawable());
  popupWindow.showAtLocation(mContext.getWindow().getDecorView(), Gravity.CENTER, 0, 0);
  popupWindow.setOnDismissListener(new PopupWindow.OnDismissListener() {
    @Override
    public void onDismiss() {
      RequestThreadPool.finish();
      cancel(true);
    }
  });
}

代码示例来源:origin: GitLqr/LQRWeChat

private void showPopupMenu() {
  if (mView == null) {
    mView = new FrameLayout(this);
    mView.setLayoutParams(new ViewGroup.LayoutParams(ViewGroup.LayoutParams.MATCH_PARENT, ViewGroup.LayoutParams.MATCH_PARENT));
    mView.setBackgroundColor(UIUtils.getColor(R.color.white));
    TextView tv = new TextView(this);
    FrameLayout.LayoutParams params = new FrameLayout.LayoutParams(FrameLayout.LayoutParams.MATCH_PARENT, UIUtils.dip2Px(45));
    tv.setLayoutParams(params);
    tv.setGravity(Gravity.LEFT | Gravity.CENTER_VERTICAL);
    tv.setPadding(UIUtils.dip2Px(20), 0, 0, 0);
    tv.setTextColor(UIUtils.getColor(R.color.gray0));
    tv.setTextSize(14);
    tv.setText(UIUtils.getString(R.string.select_qr_code_from_ablum));
    mView.addView(tv);
    tv.setOnClickListener(v -> {
      mPopupWindow.dismiss();
      Intent intent = new Intent(ScanActivity.this, ImageGridActivity.class);
      startActivityForResult(intent, IMAGE_PICKER);
    });
  }
  mPopupWindow = PopupWindowUtils.getPopupWindowAtLocation(mView, ViewGroup.LayoutParams.MATCH_PARENT, ViewGroup.LayoutParams.WRAP_CONTENT, getWindow().getDecorView().getRootView(), Gravity.BOTTOM, 0, 0);
  mPopupWindow.setOnDismissListener(() -> PopupWindowUtils.makeWindowLight(ScanActivity.this));
  PopupWindowUtils.makeWindowDark(this);
}

代码示例来源:origin: jeasonlzy/NineGridView

imm.toggleSoftInput(0, InputMethodManager.HIDE_NOT_ALWAYS);
editWindow.setOnDismissListener(new PopupWindow.OnDismissListener() {
  @Override
  public void onDismiss() {

代码示例来源:origin: GitLqr/LQRWeChat

mPopupWindow.setOnDismissListener(() -> PopupWindowUtils.makeWindowLight(ShowBigImageActivity.this));
PopupWindowUtils.makeWindowDark(ShowBigImageActivity.this);

代码示例来源:origin: arcadefire/nice-spinner

popupWindow.setOnDismissListener(new PopupWindow.OnDismissListener() {
  @Override
  public void onDismiss() {

代码示例来源:origin: Bearded-Hen/Android-Bootstrap

private void createDropDown() {
  ScrollView dropdownView = createDropDownView();
  dropdownWindow = new PopupWindow();
  dropdownWindow.setFocusable(true);
  dropdownWindow.setHeight(WindowManager.LayoutParams.WRAP_CONTENT);
  if (!isInEditMode()) {
    dropdownWindow.setBackgroundDrawable(DrawableUtils.resolveDrawable(android.R.drawable
                                          .dialog_holo_light_frame, getContext()));
  }
  dropdownWindow.setContentView(dropdownView);
  dropdownWindow.setOnDismissListener(this);
  dropdownWindow.setAnimationStyle(android.R.style.Animation_Activity);
  float longestStringWidth = measureStringWidth(getLongestString(dropdownData))
      + DimenUtils.dpToPixels((baselineItemRightPadding + baselineItemLeftPadding) * bootstrapSize);
  if (longestStringWidth < getMeasuredWidth()) {
    dropdownWindow.setWidth(DimenUtils.dpToPixels(getMeasuredWidth()));
  }
  else {
    dropdownWindow.setWidth((int) longestStringWidth + DimenUtils.dpToPixels(8));
  }
}

代码示例来源:origin: stackoverflow.com

mPopupWindow.setOnDismissListener(new OnDismissListener() {
  @Override
  public void onDismiss() {

代码示例来源:origin: pinguo-zhouwei/CustomPopwindow

/**
 * 添加一些属性设置
 * @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);
}

代码示例来源:origin: pinguo-zhouwei/CustomPopwindow

mPopupWindow.setOnDismissListener(this);

代码示例来源:origin: stackoverflow.com

optionsPopup.setOnDismissListener(new PopupWindow.OnDismissListener() {

代码示例来源:origin: baiyuliang/QRobot

/**
 * 隐藏监听
 *
 * @param onDismissListener
 */
public void setOnDismissListener(PopupWindow.OnDismissListener onDismissListener) {
  pop.setOnDismissListener(onDismissListener);
}

代码示例来源:origin: InnoFang/Android-Code-Demos

public void setOnDismissListener(PopupWindow.OnDismissListener listener) {
  if (null != mPopupWindow) {
    mPopupWindow.setOnDismissListener(listener);
  }
}

代码示例来源:origin: gpfduoduo/AirPlay-Receiver-on-Android

/**
 * Set listener on window dismissed.
 * 
 * @param listener
 */
public void setOnDismissListener(PopupWindow.OnDismissListener listener) {
  mWindow.setOnDismissListener(listener);  
}

代码示例来源:origin: com.willowtreeapps/oak-demos

public void setOnDismissListener(PopupWindow.OnDismissListener listener) {
  mPopup.setOnDismissListener(listener);
}

代码示例来源:origin: zyyoona7/EasyPopup

public T apply() {
  if (mPopupWindow == null) {
    mPopupWindow = new PopupWindow();
  }
  onPopupWindowCreated();
  initContentViewAndWH();
  onPopupWindowViewCreated(mContentView);
  if (mAnimationStyle != 0) {
    mPopupWindow.setAnimationStyle(mAnimationStyle);
  }
  initFocusAndBack();
  mPopupWindow.setOnDismissListener(this);
  if (Build.VERSION.SDK_INT >= Build.VERSION_CODES.M) {
    if (mEnterTransition != null) {
      mPopupWindow.setEnterTransition(mEnterTransition);
    }
    if (mExitTransition != null) {
      mPopupWindow.setExitTransition(mExitTransition);
    }
  }
  return self();
}

代码示例来源:origin: yihu0817/ExpandPopTabView

@Override
public void onDismiss() {
  showPopView();
  mPopupWindow.setOnDismissListener(null);
}

代码示例来源:origin: quaap/LaunchTime

@Override
  public void run() {
    mAppinfoWindow = AppInfo.showAppinfo(mMain, view, appitem);
    mAppinfoWindow.setOnDismissListener(new PopupWindow.OnDismissListener() {
      @Override
      public void onDismiss() {
        dismissAppinfo();
      }
    });
  }
});

代码示例来源:origin: stackoverflow.com

PopupWindow mPopupWindow = new PopupWindow(mRootView, WindowManager.LayoutParams.WRAP_CONTENT, WindowManager.LayoutParams.WRAP_CONTENT);
mPopupWindow.setBackgroundDrawable(new ColorDrawable(android.R.color.transparent));
mPopupWindow.setFocusable(true);
mPopupWindow.setOutsideTouchable(true);
mPopupWindow.setOnDismissListener(new PopupWindow.OnDismissListener() {
  @Override
  public void onDismiss() {
   // some action ....
  }
});

代码示例来源:origin: jzyhywxz/PopupWindow

@Override
  protected void initWindow() {
    super.initWindow();
    PopupWindow instance=getPopupWindow();
    instance.setOnDismissListener(new PopupWindow.OnDismissListener() {
      @Override
      public void onDismiss() {
        WindowManager.LayoutParams lp=getWindow().getAttributes();
        lp.alpha=1.0f;
        getWindow().clearFlags(WindowManager.LayoutParams.FLAG_DIM_BEHIND);
        getWindow().setAttributes(lp);
      }
    });
  }
};

代码示例来源:origin: bilibili/BiliShare

protected void createShareWindowIfNeed() {
  if (mShareWindow != null)
    return;
  Context context = getContext();
  GridView grid = createShareGridView(context, getItemClickListener());
  mShareWindow = new PopupWindow(grid, WindowManager.LayoutParams.MATCH_PARENT, WindowManager.LayoutParams.WRAP_CONTENT, true);
  mShareWindow.setBackgroundDrawable(new ColorDrawable(Color.WHITE));
  mShareWindow.setOutsideTouchable(true);
  mShareWindow.setAnimationStyle(R.style.socialize_shareboard_animation);
  mShareWindow.setOnDismissListener(new PopupWindow.OnDismissListener() {
    @Override
    public void onDismiss() {
      if (getDismissListener() != null)
        getDismissListener().onDismiss();
    }
  });
}

相关文章