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

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

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

PopupWindow.<init>介绍

暂无

代码示例

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

final PopupWindow popupWindow = new PopupWindow(this);
popupWindow.show(findViewById(R.id.YOUR_MAIN_LAYOUT), 0, -250);

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

@Override
public void initTipView() {
  View view = View.inflate(SessionActivity.this, R.layout.popup_audio_wi_vo, null);
  mStateIV = (ImageView) view.findViewById(R.id.rc_audio_state_image);
  mStateTV = (TextView) view.findViewById(R.id.rc_audio_state_text);
  mTimerTV = (TextView) view.findViewById(R.id.rc_audio_timer);
  mRecordWindow = new PopupWindow(view, -1, -1);
  mRecordWindow.showAtLocation(mLlRoot, 17, 0, 0);
  mRecordWindow.setFocusable(true);
  mRecordWindow.setOutsideTouchable(false);
  mRecordWindow.setTouchable(false);
}

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

@OnClick(R.id.more)
public void more(View view) {
  View popupView = mInflater.inflate(R.layout.popup_reply, null);
  popupView.findViewById(R.id.favour).setOnClickListener(this);
  popupView.findViewById(R.id.comment).setOnClickListener(this);
  window = new PopupWindow(popupView, ViewGroup.LayoutParams.WRAP_CONTENT, ViewGroup.LayoutParams.WRAP_CONTENT);
  window.setOutsideTouchable(true);
  window.setFocusable(true);
  window.setAnimationStyle(R.style.popup_more_anim);
  window.setBackgroundDrawable(new ColorDrawable(Color.BLACK));
  popupView.measure(0, 0);
  int xoff = -popupView.getMeasuredWidth();
  int yoff = -(popupView.getMeasuredHeight() + view.getHeight()) / 2;
  window.showAsDropDown(view, xoff, yoff);
}

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

/**
 * 最核心的pupupwindow创建方法
 *
 * @param contentView popupwindow要显示的视图
 * @param width       popupwindow的宽度
 * @param height      popupwindow的高度
 * @return
 */
@NonNull
private static PopupWindow getPopupWindow(View contentView, int width, int height) {
  PopupWindow popupWindow = new PopupWindow(contentView, width, height, true);
  popupWindow.setOutsideTouchable(false);
  openOutsideTouchable(popupWindow);
  return popupWindow;
}

代码示例来源: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: pili-engineering/PLDroidPlayer

private void initFloatingWindow() {
  mWindow = new PopupWindow(mContext);
  mWindow.setFocusable(false);
  mWindow.setBackgroundDrawable(null);
  mWindow.setOutsideTouchable(true);
  mAnimStyle = android.R.style.Animation;
}

代码示例来源:origin: HotBitmapGG/bilibili-android-client

private void initFloatingWindow() {
  mWindow = new PopupWindow(mContext);
  mWindow.setFocusable(false);
  mWindow.setBackgroundDrawable(null);
  mWindow.setOutsideTouchable(true);
  mAnimStyle = android.R.style.Animation;
}

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

popUpWindow = new PopupWindow(this);

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

public void onCreate(Bundle savedInstanceState) {
super.onCreate(savedInstanceState);
popUp = new PopupWindow(this);
layout = new LinearLayout(this);
mainLayout = new LinearLayout(this);

代码示例来源:origin: facebook/facebook-android-sdk

View.MeasureSpec.makeMeasureSpec(decorWidth, View.MeasureSpec.AT_MOST), 
    View.MeasureSpec.makeMeasureSpec(decorHeight, View.MeasureSpec.AT_MOST));
mPopupWindow = new PopupWindow(
    mPopupContent, 
    mPopupContent.getMeasuredWidth(),

代码示例来源:origin: seven332/EhViewer

absoluteLayout.addView(mBubble);
absoluteLayout.setBackgroundDrawable(null);
mPopup = new PopupWindow(absoluteLayout);
mPopup.setOutsideTouchable(false);
mPopup.setTouchable(false);

代码示例来源:origin: robolectric/robolectric

@Test
public void getLatestPopupWindow() {
 PopupWindow pw = new PopupWindow(new LinearLayout(context));
 pw.showAtLocation(new LinearLayout(context), Gravity.CENTER, 0, 0);
 PopupWindow latestPopupWindow = ShadowApplication.getInstance().getLatestPopupWindow();
 assertThat(latestPopupWindow).isSameAs(pw);
}

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

case R.id.comment:
  View editView = mInflater.inflate(R.layout.replay_input, null);
  editWindow = new PopupWindow(editView, ViewGroup.LayoutParams.MATCH_PARENT, ViewGroup.LayoutParams.WRAP_CONTENT);
  editWindow.setOutsideTouchable(true);
  editWindow.setFocusable(true);

代码示例来源:origin: lipangit/JiaoZiVideoPlayer

clarityPopWindow = new PopupWindow(layout, LayoutParams.WRAP_CONTENT, LayoutParams.WRAP_CONTENT, true);
clarityPopWindow.setContentView(layout);
clarityPopWindow.showAsDropDown(clarity);

代码示例来源:origin: mikepenz/Android-Iconics

);
int size = (int) UIUtils.convertDpToPixel(144, v.getContext());
mPopup = new PopupWindow(imageView, size, size);
mPopup.showAsDropDown(v);

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

popupWindow = new PopupWindow(context);
popupWindow.setContentView(listView);
popupWindow.setOutsideTouchable(true);

代码示例来源:origin: termux/termux-app

void popup(View view, String text) {
  int width = view.getMeasuredWidth();
  int height = view.getMeasuredHeight();
  Button button = new Button(getContext(), null, android.R.attr.buttonBarButtonStyle);
  button.setText(text);
  button.setTextColor(TEXT_COLOR);
  button.setPadding(0, 0, 0, 0);
  button.setMinHeight(0);
  button.setMinWidth(0);
  button.setMinimumWidth(0);
  button.setMinimumHeight(0);
  button.setWidth(width);
  button.setHeight(height);
  button.setBackgroundColor(BUTTON_PRESSED_COLOR);
  popupWindow = new PopupWindow(this);
  popupWindow.setWidth(LayoutParams.WRAP_CONTENT);
  popupWindow.setHeight(LayoutParams.WRAP_CONTENT);
  popupWindow.setContentView(button);
  popupWindow.setOutsideTouchable(true);
  popupWindow.setFocusable(false);
  popupWindow.showAsDropDown(view, 0, -2 * height);
}

代码示例来源:origin: ZieIony/Carbon

if (focused) {
  if (clearFocusOnTouchOutside) {
    PopupWindow popupWindow = new PopupWindow(getContext());
    popupWindow.setBackgroundDrawable(new ColorDrawable(0x7fff0000));
    popupWindow.setTouchable(true);

代码示例来源: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: pili-engineering/PLDroidShortVideo

private void initFloatingWindow() {
  mWindow = new PopupWindow(mContext);
  mWindow.setFocusable(false);
  mWindow.setBackgroundDrawable(null);
  mWindow.setOutsideTouchable(true);
  mAnimStyle = android.R.style.Animation;
}

相关文章