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

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

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

PopupWindow.setWindowLayoutMode介绍

暂无

代码示例

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

private void showLocationPopup() {

  LayoutInflater inflater = (LayoutInflater)
      getActivity().getSystemService(Context.LAYOUT_INFLATER_SERVICE);
  View layout = inflater.inflate(R.layout.popup_location,(ViewGroup) getActivity().findViewById(R.id.layout_location_popup));
  PopupWindow pw = new PopupWindow(
      layout,
      100,
      100,
      true);
  // The code below assumes that the root container has an id called 'main'
  pw.setWindowLayoutMode(ViewGroup.LayoutParams.WRAP_CONTENT, ViewGroup.LayoutParams.WRAP_CONTENT);
  pw.showAtLocation(layout, Gravity.CENTER, 0, 0);

}

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

private View empty;

@Override public void onCreate(Bundle savedState)
{
  super.onCreate(savedState);
  empty = new View(this);
  setContentView(empty);
}

@Override public void onAttachedToWindow()
{
  View topview = getLayoutInflater().inflate(R.layout.mylayout, null);
  PopupWindow pw = new PopupWindow(topview);
  pw.setWindowLayoutMode(LayoutParams.MATCH_PARENT, LayoutParams.MATCH_PARENT);
  pw.showAtLocation(empty, 0, 0, 0);
}

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

PopupWindow mPopupWindow = null;

mIconButton.setOnClickListener(new OnClickListener() {

        @Override
        public void onClick(View v) {
          if (mPopupWindow != null) {
            mPopupWindow.dismiss();
            mPopupWindow = null;
          }

          TextView tv = new TextView(getApplicationContext());
          tv.setText(tooltipText);
          tv.setCompoundDrawablesWithIntrinsicBounds(R.drawable.icon,
              0, 0, 0);
          mPopupWindow = new PopupWindow(tv);

          mPopupWindow.setWindowLayoutMode(
              ViewGroup.LayoutParams.WRAP_CONTENT,
              ViewGroup.LayoutParams.WRAP_CONTENT);

          mPopupWindow.showAsDropDown(v);

// write threads to disable it based on time as well

        }
      });

代码示例来源:origin: layerhq/Atlas-Android

private void initAttachmentMenu(Context context, AttributeSet attrs, int defStyle) {
  if (mAttachmentMenu != null) throw new IllegalStateException("Already initialized menu");
  if (attrs == null) {
    mAttachmentMenu = new PopupWindow(context);
  } else {
    mAttachmentMenu = new PopupWindow(context, attrs, defStyle);
  }
  mAttachmentMenu.setContentView(LayoutInflater.from(context).inflate(R.layout.atlas_message_composer_attachment_menu, null));
  mAttachmentMenu.setWindowLayoutMode(ViewGroup.LayoutParams.WRAP_CONTENT, ViewGroup.LayoutParams.WRAP_CONTENT);
  mAttachmentMenu.setOutsideTouchable(true);
  mAttachmentMenu.setBackgroundDrawable(mAttachmentSendersBackground);
  mAttachmentMenu.setFocusable(true);
}

代码示例来源:origin: PhilippC/keepass2android

mPreviewPopup = new PopupWindow(context);
mPreviewText = (TextView) inflate.inflate(R.layout.candidate_preview, null);
mPreviewPopup.setWindowLayoutMode(LayoutParams.WRAP_CONTENT, LayoutParams.WRAP_CONTENT);
mPreviewPopup.setContentView(mPreviewText);
mPreviewPopup.setBackgroundDrawable(null);

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

PopupWindow popup=new PopupWindow(this);
popup.setBackgroundDrawable(new ColorDrawable(android.graphics.Color.TRANSPARENT));
popup.setWindowLayoutMode(FrameLayout.LayoutParams.WRAP_CONTENT,FrameLayout.LayoutParams.WRAP_CONTENT);
popup.setContentView(R.layout.coach_mark);
View view=findById(R.id.view_of_main_layout);
int[] viewLocation=new int[2];
view.getLocationInWindow(viewLocation)
popup.showAtLocation(view, Gravity.TOP|Gravity.LEFT, viewLocation[0],viewLocation[1]);

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

popupWindow.setWindowLayoutMode(
    ViewGroup.LayoutParams.WRAP_CONTENT,
    ViewGroup.LayoutParams.WRAP_CONTENT);

代码示例来源:origin: chenpengfei88/PromptView

private void createPrompt(final View srcView) {
  final View promptView = promptViewManager.getPromptView();
  if(popupWindow == null)
    popupWindow =  new PopupWindow(activity);
  popupWindow.setWindowLayoutMode(ViewGroup.LayoutParams.WRAP_CONTENT, ViewGroup.LayoutParams.WRAP_CONTENT);
  popupWindow.setTouchable(true);
  popupWindow.setOutsideTouchable(true);
  popupWindow.setBackgroundDrawable( new ColorDrawable(Color.TRANSPARENT));
  popupWindow.setContentView(promptView);
  final int[] location = new int[2];
  promptView.getViewTreeObserver().addOnGlobalLayoutListener(new ViewTreeObserver.OnGlobalLayoutListener() {
    @Override
    public void onGlobalLayout() {
      if(!isShow && popupWindow.isShowing()) {
        popupWindow.dismiss();
        show(srcView, promptView, location);
        isShow = true;
      }
    }
  });
  srcView.getLocationOnScreen(location);
  show(srcView, promptView, location);
}

代码示例来源:origin: mooshim/Mooshimeter-AndroidApp

public void onConfigButton(View v) {
  if(mSettingsWindow.isShowing()) {
    mSettingsWindow.dismiss();
  } else {
    View base = this.findViewById(android.R.id.content);
    mSettingsWindow.setFocusable(true);
    mSettingsWindow.setWindowLayoutMode(
        ViewGroup.LayoutParams.WRAP_CONTENT,
        ViewGroup.LayoutParams.WRAP_CONTENT);
    // Clear the default translucent background
    mSettingsWindow.setBackgroundDrawable(new BitmapDrawable());
    mSettingsWindow.showAtLocation(base, Gravity.CENTER,0,0);
  }
}

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

spinner.setWindowLayoutMode(ViewGroup.LayoutParams.WRAP_CONTENT, ViewGroup.LayoutParams.WRAP_CONTENT);
spinner.setFocusable(true);

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

mPopup.setWindowLayoutMode(
        mDropDownWidth == ViewGroup.LayoutParams.MATCH_PARENT ?
            ViewGroup.LayoutParams.MATCH_PARENT : 0, 0);
  } else {
    mPopup.setWindowLayoutMode(
        mDropDownWidth == ViewGroup.LayoutParams.MATCH_PARENT ?
            ViewGroup.LayoutParams.MATCH_PARENT : 0,
mPopup.setWindowLayoutMode(widthSpec, heightSpec);

相关文章