类android.widget.PopupWindow源码实例Demo

下面列出了怎么用android.widget.PopupWindow的API类实例代码及写法,或者点击链接到github查看源代码。

源代码1 项目: letv   文件: AlbumCommentDetailActivity.java
public void showPopupWindow(View target) {
    if (target != null) {
        if (this.morePopupWindow == null) {
            this.morePopupWindow = new PopupWindow(BaseApplication.getInstance());
            this.morePopupWindow.setBackgroundDrawable(new BitmapDrawable());
            this.morePopupWindow.setWidth(UIsUtils.zoomWidth(60));
            this.morePopupWindow.setHeight(UIsUtils.zoomWidth(40));
            this.morePopupWindow.setOutsideTouchable(true);
            this.morePopupWindow.setFocusable(true);
            this.morePopupWindow.setContentView(this.popupContentView);
        }
        int[] location = new int[2];
        target.getLocationOnScreen(location);
        LogInfo.log("Emerson", "-----------location[1] = " + location[1]);
        this.morePopupWindow.showAtLocation(target, 0, location[0] + ((target.getWidth() - UIsUtils.dipToPx(40.0f)) / 2), (location[1] + (target.getHeight() / 2)) - UIsUtils.dipToPx(60.0f));
        this.morePopupWindow.update();
    }
}
 
源代码2 项目: progresshint   文件: ProgressHintDelegate.java
private void initHintPopup() {
  String popupText = null;
  if (mHintAdapter != null) {
    popupText = mHintAdapter.getHint(mSeekBar, mSeekBar.getProgress());
  }

  // init views
  LayoutInflater inflater = (LayoutInflater) mSeekBar.getContext().getSystemService(Context.LAYOUT_INFLATER_SERVICE);
  mPopupView = inflater.inflate(mPopupLayout, null);
  mPopupView.measure(makeMeasureSpec(0, UNSPECIFIED), makeMeasureSpec(0, UNSPECIFIED));
  mPopupTextView = mPopupView.findViewById(android.R.id.text1);
  mPopupTextView.setText(popupText != null ? popupText : String.valueOf(mSeekBar.getProgress()));
  // init popup
  mPopup = new PopupWindow(mPopupView, WRAP_CONTENT, WRAP_CONTENT, false);
  mPopup.setAnimationStyle(mPopupAnimStyle);
}
 
源代码3 项目: ratebeer   文件: BeerActivity.java
private void addBeerToCustomList(Beer beer, long listId, PopupWindow popup) {
	Db.getCustomListBeer(this, listId, beer._id)
			.compose(bindToLifecycle())
			.defaultIfEmpty(null)
			.subscribe(existingBeerOnList -> {
				if (existingBeerOnList == null) {
					CustomListBeer addBeer = new CustomListBeer();
					addBeer.listId = listId;
					addBeer.beerId = beer._id;
					addBeer.beerName = beer.name;
					rxdb(this).put(addBeer);
					listAddButton.setChecked(true);
				} else {
					rxdb(this).delete(existingBeerOnList);
					listAddButton.setChecked(false);
				}
			});
	popup.dismiss();
}
 
源代码4 项目: Simpler   文件: WebViewActivity.java
/**
 * 显示PopupWindow:WebView操作
 *
 * @param view
 */
private void showWebViewOpWindow(View view) {
    View contentView = getLayoutInflater().inflate(R.layout.window_webview_op, null);
    // 设置Item的点击事件
    LinearLayout llRefresh = (LinearLayout) contentView.findViewById(R.id.llRefresh);
    LinearLayout llCopyUrl = (LinearLayout) contentView.findViewById(R.id.llCopyUrl);
    LinearLayout llOpen = (LinearLayout) contentView.findViewById(R.id.llOpen);

    final PopupWindow popupWindow = new PopupWindow(contentView,
            RelativeLayout.LayoutParams.WRAP_CONTENT, RelativeLayout.LayoutParams.WRAP_CONTENT, true);

    OpClickListener listener = new OpClickListener(popupWindow);
    llRefresh.setOnClickListener(listener);
    llCopyUrl.setOnClickListener(listener);
    llOpen.setOnClickListener(listener);

    // 如果不设置PopupWindow的背景,无论是点击外部区域还是Back键都无法dismiss弹框
    popupWindow.setBackgroundDrawable(getResources().getDrawable(R.drawable.popup_transparent_bg));

    // 设置好参数之后再show
    popupWindow.showAsDropDown(view);
}
 
源代码5 项目: connectivity-samples   文件: JUIHelper.java
public void closeWidget(final View view) {
    JUIForwardingPopupWindow window = null;
    // Check if the control has dummy popupwindow to forward user inputs
    try {
        Method method = view.getClass().getMethod("getDummyWindow");
        window = (JUIForwardingPopupWindow) method.invoke(view);
    } catch (Exception e) {
    }

    final PopupWindow closingWindow = window;
    activity_.runOnUiThread(new Runnable() {
        @Override
        public void run() {
            if (closingWindow != null) {
                dummyWindows_.remove(closingWindow);
                closingWindow.dismiss();
            }
            JUIRelativeLayout_.removeView(view);
        }
    });
    return;
}
 
源代码6 项目: Study_Android_Demo   文件: MainActivity.java
public void doClick(View view) {
	//AlertDialog����
	// 1.����AlertDialog
	// AlertDialog dialog = new AlertDialog.Builder(this).setTitle("title")
	// .setMessage("message").create();
	// 2.ͨ��Dialog��ȡWindow
	// Window window = dialog.getWindow();
	// window.setGravity(Gravity.BOTTOM); // �˴���������dialog��ʾ��λ��
	// 3.��Window�������ö������
	// window.setWindowAnimations(R.style.dialogWindowAnim); // ��Ӷ���
	// ��ʾ�Ի���
	// dialog.show();
	
	//popupwindow�Ķ���
	View popupwindow = getLayoutInflater().inflate(
			R.layout.popupwindow_layout, null);
	PopupWindow pop = new PopupWindow(popupwindow,
			ViewGroup.LayoutParams.WRAP_CONTENT,
			ViewGroup.LayoutParams.WRAP_CONTENT);
	pop.setAnimationStyle(R.style.dialogWindowAnim);
	pop.showAsDropDown(view);
}
 
源代码7 项目: cwac-security   文件: MainActivity.java
protected void showPopupWindow() {
  Button popupContent=new Button(this);

  popupContent.setText(R.string.label_click);
  popupContent.setLayoutParams(new ViewGroup.LayoutParams(
    ViewGroup.LayoutParams.WRAP_CONTENT,
    ViewGroup.LayoutParams.WRAP_CONTENT));
  popupContent.measure(View.MeasureSpec.UNSPECIFIED,
    View.MeasureSpec.UNSPECIFIED);

  final PopupWindow popup=
    new PopupWindow(popupContent, popupContent.getMeasuredWidth(),
      popupContent.getMeasuredHeight(), true);

  popupContent.setOnClickListener(new View.OnClickListener() {
    @Override
    public void onClick(View v) {
      popup.dismiss();
    }
  });

  popup.showAsDropDown(popupAnchor);
}
 
源代码8 项目: UseTimeStatistic   文件: MainActivity.java
private void showPopWindow(){
    View contentView = LayoutInflater.from(MainActivity.this).inflate(R.layout.popuplayout, null);
    mPopupWindow = new PopupWindow(contentView);
    mPopupWindow.setWidth(ViewGroup.LayoutParams.MATCH_PARENT);
    mPopupWindow.setHeight(ViewGroup.LayoutParams.WRAP_CONTENT);

    mRvSelectDate = contentView.findViewById(R.id.rv_select_date);
    SelectDateAdapter adapter = new SelectDateAdapter(mDateList);
    adapter.setOnItemClickListener(new SelectDateAdapter.OnRecyclerViewItemClickListener() {
        @Override
        public void onItemClick(View view, int position) {
            mUseTimeDataManager.refreshData(position);
            showView(position);
            mPopupWindow.dismiss();
            isShowing = false;
        }
    });
    mRvSelectDate.setAdapter(adapter);
    mRvSelectDate.setLayoutManager(new LinearLayoutManager(this));

    mPopupWindow.showAsDropDown(mBtnDate);
    isShowing = true;
}
 
源代码9 项目: fanfouapp-opensource   文件: PopupWindows.java
/**
 * Constructor.
 * 
 * @param context
 *            Context
 */
public PopupWindows(final Context context) {
    mContext = context;
    mWindow = new PopupWindow(context);

    mWindow.setTouchInterceptor(new OnTouchListener() {
        @Override
        public boolean onTouch(final View v, final MotionEvent event) {
            if (event.getAction() == MotionEvent.ACTION_OUTSIDE) {
                mWindow.dismiss();

                return true;
            }

            return false;
        }
    });

    mWindowManager = (WindowManager) context
            .getSystemService(Context.WINDOW_SERVICE);
}
 
源代码10 项目: tysq-android   文件: HomePageSearchFragment.java
private void showPopupWindow() {
    View window = getLayoutInflater()
            .inflate(R.layout.fragment_home_page_search_popupwindow, null);

    window.findViewById(R.id.tv_article).setOnClickListener(this);
    window.findViewById(R.id.tv_label).setOnClickListener(this);
    window.findViewById(R.id.tv_admin).setOnClickListener(this);

    mTypeWindow = new PopupWindow(window,
            ViewGroup.LayoutParams.WRAP_CONTENT,
            ViewGroup.LayoutParams.WRAP_CONTENT,
            true);

    mTypeWindow.setOutsideTouchable(true);
    mTypeWindow.showAsDropDown(tvType, -tvType.getWidth() / 2, tvType.getHeight() / 2);
}
 
源代码11 项目: WidgyWidgets   文件: EditTextWithCustomError.java
private void chooseSize(PopupWindow pop, CharSequence text, TextView tv) {
	int wid = tv.getPaddingLeft() + tv.getPaddingRight();
	int ht = tv.getPaddingTop() + tv.getPaddingBottom();

	/*
	 * Figure out how big the text would be if we laid it out to the
	 * full width of this view minus the border.
	 */
	int cap = getWidth() - wid;
	if (cap < 0) {
		cap = 200; // We must not be measured yet -- setFrame() will fix it.
	}

	Layout l = new StaticLayout(text, tv.getPaint(), cap,
			Layout.Alignment.ALIGN_NORMAL, 1, 0, true);
	float max = 0;
	for (int i = 0; i < l.getLineCount(); i++) {
		max = Math.max(max, l.getLineWidth(i));
	}

	/*
	 * Now set the popup size to be big enough for the text plus the border.
	 */
	pop.setWidth(wid + (int) Math.ceil(max));
	pop.setHeight(ht + l.getHeight());
}
 
源代码12 项目: imsdk-android   文件: PictureSelectorActivity.java
/**
 * 初始化展示文件夹的popupWindw
 */
private void initListDirPopupWindw() {
    mListImageDirPopupWindow = new ListImageDirPopupWindow(
            ViewGroup.LayoutParams.MATCH_PARENT, (int) (mScreenHeight * 0.7),
            mImageFloders, LayoutInflater.from(PictureSelectorActivity.this)
            .inflate(R.layout.atom_ui_layout_popmenu_list_dir, null));

    mListImageDirPopupWindow.setOnDismissListener(new PopupWindow.OnDismissListener() {
        @Override
        public void onDismiss() {
            // 设置背景颜色变暗
            WindowManager.LayoutParams lp = getWindow().getAttributes();
            lp.alpha = 1.0f;
            getWindow().setAttributes(lp);
        }
    });
    // 设置选择文件夹的回调
    mListImageDirPopupWindow.setOnImageDirSelected(this);
}
 
源代码13 项目: Android-Application-ZJB   文件: BigImgView.java
public BigImgView(final Context context, String url, final View view) {
    // 一个自定义的布局,作为显示的内容
    final View contentView = LayoutInflater.from(context).inflate(
            R.layout.vw_bigimg, null);

    popupWindow = new PopupWindow(contentView,
            ViewGroup.LayoutParams.MATCH_PARENT, ViewGroup.LayoutParams.MATCH_PARENT, true);
    popupWindow.setOutsideTouchable(true);
    popupWindow.setTouchable(true);

    ImageView imageView = (ImageView) contentView.findViewById(R.id.bigImg_img);
    ViewUtils.showImage(imageView, url);

    Logger.i("显示图片:"+url);
    imageView.setOnClickListener(this);
    contentView.findViewById(R.id.bigImgPop_layout).setOnClickListener(this);

    // 如果不设置PopupWindow的背景,无论是点击外部区域还是Back键都无法dismiss弹框
    // 我觉得这里是API的一个bug
    popupWindow.setBackgroundDrawable(new BitmapDrawable());

    popupWindow.showAtLocation(view, Gravity.NO_GRAVITY, 0, 0);
}
 
源代码14 项目: fangzhuishushenqi   文件: SelectionLayout.java
private void createPopupWindow() {
    mListPopupWindow = new ListPopupWindow(mContext);
    mAdapter = new SelAdapter(mContext, data);
    mListPopupWindow.setAdapter(mAdapter);
    mListPopupWindow.setWidth(ViewGroup.LayoutParams.MATCH_PARENT);
    mListPopupWindow.setHeight(ViewGroup.LayoutParams.WRAP_CONTENT);
    mListPopupWindow.setAnchorView(parent.getChildAt(0));
    mListPopupWindow.setForceIgnoreOutsideTouch(false);
    mListPopupWindow.setOnItemClickListener(this);
    mListPopupWindow.setOnDismissListener(new PopupWindow.OnDismissListener() {
        @Override
        public void onDismiss() {
            ivArrow.startAnimation(operatingAnim2);
            isOpen = false;
        }
    });
    mListPopupWindow.setModal(true);
}
 
源代码15 项目: AdvancedTextView   文件: SelectableTextView.java
/**
 * 长按弹出菜单
 *
 * @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();
        }
    });
}
 
源代码16 项目: Jreader   文件: ReadActivity.java
/**
 * 初始化所有POPUPWINDOW
 */
private void setPop() {
    popupwindwow = this.getLayoutInflater().inflate(R.layout.bookpop, null);
    toolpop = this.getLayoutInflater().inflate(R.layout.toolpop, null);
    mPopupWindow = new PopupWindow(popupwindwow, LayoutParams.MATCH_PARENT,
            LayoutParams.WRAP_CONTENT);
  //  mPopupWindow.setAnimationStyle(R.style.popwin_anim_style);
    mToolpop = new PopupWindow(toolpop, LayoutParams.MATCH_PARENT,
            LayoutParams.WRAP_CONTENT);
    toolpop1 = this.getLayoutInflater().inflate(R.layout.tool_size, null);
    mToolpop1 = new PopupWindow(toolpop1, LayoutParams.MATCH_PARENT,
            LayoutParams.WRAP_CONTENT);
    toolpop2 = this.getLayoutInflater().inflate(R.layout.tool_light, null);
    mToolpop2 = new PopupWindow(toolpop2, LayoutParams.MATCH_PARENT,
            LayoutParams.WRAP_CONTENT);
    toolpop3 = this.getLayoutInflater().inflate(R.layout.tool_mark, null);
    mToolpop3 = new PopupWindow(toolpop3, LayoutParams.MATCH_PARENT,
            LayoutParams.WRAP_CONTENT);
    toolpop4 = this.getLayoutInflater().inflate(R.layout.tool_jump, null);
    mToolpop4 = new PopupWindow(toolpop4, LayoutParams.MATCH_PARENT,
            LayoutParams.WRAP_CONTENT);
    playView = this.getLayoutInflater().inflate(R.layout.play_pop, null);
    playpop = new PopupWindow(playView, LayoutParams.WRAP_CONTENT,
            LayoutParams.WRAP_CONTENT);

}
 
源代码17 项目: NewsMe   文件: AnimationToast.java
public AnimationToast(Context context, View view, int bgResId,
		int textSizeResId) {
	if (view instanceof TextView) {
		mTextView = (TextView) view;
	}
	// mPopToast = new PopupWindow(view, width, height);
	mPopToast = new PopupWindow(view);
	// mPopToast.setAnimationStyle(DEFAULT_ANIMATION_STYLE);
	mPopToast.setWindowLayoutMode(ViewGroup.LayoutParams.WRAP_CONTENT,
			ViewGroup.LayoutParams.WRAP_CONTENT);

	// int drawableBg = context.getResources().getIdentifier(
	// "toast_animation_bg", "drawable", context.getPackageName());
	Resources resources = context.getResources();
	float value = resources.getDisplayMetrics().scaledDensity;
	mTextView.setTextSize(resources.getDimension(textSizeResId) / value);
	mPopToast.setBackgroundDrawable(resources.getDrawable(bgResId));
	mPopToast.setFocusable(false);
	// mPopToast.setOutsideTouchable(true);
}
 
源代码18 项目: ShoppingCartDemo   文件: ProductDetailsActivity.java
private void initViews() {
    mTVList = (TextView) findViewById(R.id.tv_activity_product_details_list);
    mTVDetails = (TextView) findViewById(R.id.tv_activity_product_details_details);
    mBtnAddToCart = (Button) findViewById(R.id.btn_activity_product_details_add_to_cart);
    mImgDetails = (ImageView) findViewById(R.id.img_activity_product);
    mTVTopPrice = (TextView) findViewById(R.id.tv_activity_product_details_price);

    mPop = LayoutInflater.from(this).inflate(R.layout.popup_add_to_cart, null);
    mImgIcon = (ImageView) mPop.findViewById(R.id.img_pop_icon);
    mBtnOK = (Button) mPop.findViewById(R.id.btn_pop_ok);
    mBtnMinute = (Button) mPop.findViewById(R.id.btn_pop_minute);
    mBtnPlus = (Button) mPop.findViewById(R.id.btn_pop_plus);
    mImgClose = (ImageView) mPop.findViewById(R.id.img_pop_close);
    mTVNumber = (TextView) mPop.findViewById(R.id.tv_pop_number);
    mTVPopDetails = (TextView) mPop.findViewById(R.id.tv_pop_details);
    mTVPrice = (TextView) mPop.findViewById(R.id.tv_pop_price);
    mTVPopCategory = (TextView) mPop.findViewById(R.id.tv_pop_category);
    mPopupWindow = new PopupWindow(mPop, getWindow().getAttributes().width, 1080);
}
 
源代码19 项目: AndroidSamples   文件: PopshowAtLocationActivity.java
private void showPopupWindow() {
    View contentView = LayoutInflater.from(PopshowAtLocationActivity.this).inflate(R.layout.show_at_location_activity_popup, null);

    mPopWindow = new PopupWindow(contentView,
            ViewGroup.LayoutParams.MATCH_PARENT, ViewGroup.LayoutParams.WRAP_CONTENT, true);

    mPopWindow.setBackgroundDrawable(new BitmapDrawable());
    mPopWindow.setOutsideTouchable(true);

    TextView tv1 = contentView.findViewById(R.id.pop_computer);
    TextView tv2 = contentView.findViewById(R.id.pop_financial);
    TextView tv3 = contentView.findViewById(R.id.pop_manage);
    tv1.setOnClickListener(this);
    tv2.setOnClickListener(this);
    tv3.setOnClickListener(this);

    View rootview = LayoutInflater.from(PopshowAtLocationActivity.this).inflate(R.layout.show_at_location_activity, null);
    mPopWindow.showAtLocation(rootview, Gravity.BOTTOM, 0, 0);
}
 
源代码20 项目: Tok-Android   文件: RecentMsgFragment.java
@Override
public void onItemLongClick(View view, int position) {
    LogUtil.i(TAG, "onItemLongClick position:" + position);
    PopupWindow popupWindow =
        MenuPopWindow.getMenuView(this.getActivity(), MenuPopWindow.TYPE_RECENT,
            new MenuListener(mConversationList.get(position)));
    int windowPos[] = MenuPopWindow.calculatePopWindowPos(view, view);
    popupWindow.showAtLocation(view, Gravity.TOP | Gravity.START, windowPos[0], windowPos[1]);
}
 
private void showPopupWindow() {
    View contentView = LayoutInflater.from(PopupShowAsDropDownActivity.this).inflate(R.layout.show_as_drop_down_activity_popup, null);
    mPopWindow = new PopupWindow(contentView);
    mPopWindow.setWidth(ViewGroup.LayoutParams.WRAP_CONTENT);
    mPopWindow.setHeight(ViewGroup.LayoutParams.WRAP_CONTENT);

    TextView tv1 = contentView.findViewById(R.id.pop_computer);
    TextView tv2 = contentView.findViewById(R.id.pop_financial);
    TextView tv3 = contentView.findViewById(R.id.pop_manage);
    tv1.setOnClickListener(this);
    tv2.setOnClickListener(this);
    tv3.setOnClickListener(this);

    mPopWindow.showAsDropDown(mMenuTv);
}
 
源代码22 项目: connectivity-samples   文件: JUIHelper.java
public void resumePopupWindow(NativeActivity act, final PopupWindow p) {
    activity_ = act;
    if(p.isShowing()) {
        Log.i("JUIHelper::", "ResumePopupWindow is to about to show");
    }
    return;
}
 
public BasePredictionPopupWindow(Context context, @LayoutRes int layout) {
    super(LayoutInflater.from(context).inflate(layout, null), MATCH_PARENT, MATCH_PARENT, false);

    setBackgroundDrawable(ContextCompat.getDrawable(getContentView().getContext(), R.drawable.prediction_popup_bg));
    setSoftInputMode(WindowManager.LayoutParams.SOFT_INPUT_ADJUST_RESIZE);
    setInputMethodMode(PopupWindow.INPUT_METHOD_NEEDED);
    setAnimationStyle(R.style.Animation);

    if (Build.VERSION.SDK_INT >= Build.VERSION_CODES.LOLLIPOP)
        setElevation(24);
}
 
public static void showPopup(View v) {
    final Context c = v.getContext();
    LayoutInflater inflater = LayoutInflater.from(c);
    TextView contentView = (TextView) inflater.inflate(R.layout.participant_popup_item, null);
    contentView.setText(v.getTag(R.id.poster_name).toString());
    PopupWindow popup = new PopupWindow(c);
    popup.setContentView(contentView);
    popup.setOutsideTouchable(true);
    popup.setWindowLayoutMode(LayoutParams.WRAP_CONTENT, LayoutParams.WRAP_CONTENT);
    popup.setBackgroundDrawable(c.getResources().getDrawable(R.drawable.poster_popup_bg));
    popup.showAsDropDown(v);
}
 
源代码25 项目: FilterTabView   文件: PopupEntityLoaderImp.java
@Override
public PopupWindow getPopupEntity(Context context, List data, int filterType, int position, OnFilterToViewListener onFilterToViewListener, FilterTabView view) {

    PopupWindow popupWindow = null;

    switch (filterType) {
        case FilterTabConfig.FILTER_TYPE_AREA:
            popupWindow = new AreaSelectPopupWindow(context,data,filterType,position, onFilterToViewListener, view);
            break;
        case FilterTabConfig.FILTER_TYPE_PRICE:
            popupWindow = new PriceSelectPopupWindow(context, data, filterType,position, onFilterToViewListener);
            break;
        case FilterTabConfig.FILTER_TYPE_SINGLE_SELECT:
            popupWindow = new SingleSelectPopupWindow(context,data,filterType,position, onFilterToViewListener);
            break;
        case FilterTabConfig.FILTER_TYPE_MUL_SELECT:
            popupWindow = new MulSelectPopupwindow(context,data,filterType,position, onFilterToViewListener);
            break;
        case FilterTabConfig.FILTER_TYPE_SINGLE_GIRD:
            popupWindow = new GridSelectPopupWindow(context,data,filterType,position, onFilterToViewListener);
            break;
        default:
            break;
    }

    return popupWindow;
}
 
源代码26 项目: secure-quick-reliable-login   文件: BaseActivity.java
protected void setupCameraAccessPopupWindow(LayoutInflater layoutInflater) {
    View popupView = layoutInflater.inflate(R.layout.fragment_camera_permission, null);

    cameraAccessPopupWindow = new PopupWindow(popupView,
            ViewGroup.LayoutParams.MATCH_PARENT, ViewGroup.LayoutParams.MATCH_PARENT,
            false);

    final Button btnCameraPermissionOk = popupView.findViewById(R.id.btnCameraPermissionOk);
    btnCameraPermissionOk.setOnClickListener(v -> {
        requestPermission();
        cameraAccessPopupWindow.dismiss();
    });
}
 
源代码27 项目: xmpp   文件: LuntanToStateActivity.java
/**
 * 初始化popupwindow
 */
private void initialPopups() {
    popImageView = new ImageView(this);
    // popImageView.setPadding(50, 50, 50, 50);
    popupWindow = new PopupWindow(popImageView, ViewGroup.LayoutParams.MATCH_PARENT, ViewGroup.LayoutParams.MATCH_PARENT);
    popupWindow.setBackgroundDrawable(new ColorDrawable(0xb0000000));

}
 
源代码28 项目: litho   文件: TooltipTriggerExampleComponentSpec.java
private static PopupWindow createTooltip(final ComponentContext c, final String text) {
  final LithoView tooltip =
      LithoView.create(
          c,
          Column.create(c)
              .paddingDip(YogaEdge.ALL, 15)
              .backgroundColor(LITHO_PINK)
              .child(Text.create(c).text(text).textColor(Color.WHITE))
              .build());
  return new PopupWindow(
      tooltip,
      LinearLayout.LayoutParams.WRAP_CONTENT,
      LinearLayout.LayoutParams.WRAP_CONTENT,
      true);
}
 
源代码29 项目: tysq-android   文件: PersonalHomePageFragment.java
private void initWindow() {
    View window = getLayoutInflater().inflate(R.layout.window_personal_menu, null);
    window.findViewById(R.id.tv_forbid_comment).setOnClickListener(this);
    mMenuWindow = new PopupWindow(window,
            ViewGroup.LayoutParams.WRAP_CONTENT,
            ViewGroup.LayoutParams.WRAP_CONTENT,
            true);

    mMenuWindow.setOutsideTouchable(true);
    mMenuWindow.setBackgroundDrawable(
            ContextCompat.getDrawable(getContext(), R.drawable.ic_one_inch_alpha)
    );
}
 
源代码30 项目: ToDay   文件: SandBoxActivity.java
private void displayStatsPopup(View anchor) {
    LayoutInflater layoutInflater = (LayoutInflater) this
            .getSystemService(Context.LAYOUT_INFLATER_SERVICE);
    View layout = layoutInflater.inflate(R.layout.popup_window_flow_stats, null);

    RelativeLayout viewGroup = (RelativeLayout)  layout.findViewById(R.id.popup_stats);

    // Creating the PopupWindow
    final PopupWindow popup = new PopupWindow(layout, RelativeLayout.LayoutParams.WRAP_CONTENT,
            RelativeLayout.LayoutParams.WRAP_CONTENT);

    TextView elementCount = (TextView) viewGroup.findViewById(R.id.stats_total_elements);
    TextView timeEstimate = (TextView) viewGroup.findViewById(R.id.stats_total_time);
    TextView completeCount = (TextView) viewGroup.findViewById(R.id.stats_times_complete);
    TextView lifeTimeInFlow = (TextView) viewGroup.findViewById(R.id.stats_life_time_spent_in_flow);

    elementCount.setText(
            String.valueOf(currentToDay.getChildCount())
    );

    timeEstimate.setText(
            String.valueOf(currentToDay.getFormattedTime())
    );

    completeCount.setText(
            String.valueOf(currentToDay.getCompletionTokens())
    );

    lifeTimeInFlow.setText(
            String.valueOf(
                    AppUtils.buildTimerStyleTime(currentToDay.getLifeTimeInToDay()))
    );

    popup.setBackgroundDrawable(new BitmapDrawable(null,""));
    popup.setFocusable(true);
    popup.showAsDropDown(anchor);

}
 
 类所在包
 同包方法