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

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

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

PopupWindow.getContentView介绍

暂无

代码示例

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

@Override public void onDismiss() {
  setSelected(false);
  dropdownWindow.getContentView().scrollTo(0, 0);
}

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

PopupWindow popup = new PopupWindow(contentView, width, height);
popup.setBackgroundDrawable(background);
popup.showAsDropDown(anchor);

View container = (View) popup.getContentView().getParent();
WindowManager wm = (WindowManager) getSystemService(Context.WINDOW_SERVICE);
WindowManager.LayoutParams p = (WindowManager.LayoutParams) container.getLayoutParams();
p.flags = WindowManager.LayoutParams.FLAG_DIM_BEHIND;
p.dimAmount = 0.3f;
wm.updateViewLayout(container, p);

代码示例来源:origin: square/assertj-android

public PopupWindowAssert hasContentView(View view) {
 isNotNull();
 View actualView = actual.getContentView();
 assertThat(actualView) //
   .overridingErrorMessage("Expected content view <%s> but was <%s>.", view, actualView) //
   .isSameAs(view);
 return this;
}

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

/**
 * 获取PopupWindow中加载的view
 *
 * @return
 */
public View getContentView() {
  if (mPopupWindow != null) {
    return mPopupWindow.getContentView();
  } else {
    return null;
  }
}

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

@Override
  public void onTitleClick(View view) {
    if (mWeiboPop != null) {
      Log.e(TAG, "onTitleClick: " + view.getWidth());
      mWeiboPop.showAsDropDown(view, view.getWidth() / 2 - mWeiboPop.getContentView().getWidth() / 2, 0);
    }
  }
});

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

@Override
  public void onClick(View v) {
    if (mCiclePop != null) {
      mCiclePop.showAsDropDown(v,-mCiclePop.getContentView().getWidth(),-(mCommentBtn.getHeight()/2+mCiclePop.getContentView().getHeight()/2));
    }
  }
});

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

@Override
public void onRightClick(View view) {
  if (mQQPop != null) {
    mQQPop.showAsDropDown(view, -mQQPop.getContentView().getWidth() + SizeUtils.dp2px(30), 0);
  }
}

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

private void test(){
  LayoutInflater inflater = (LayoutInflater)getSystemService(Context.LAYOUT_INFLATER_SERVICE);
  View contentview = inflater.inflate(R.layout.pop_layout1, null);
  final PopupWindow popupWindow = new PopupWindow(contentview, ViewGroup.LayoutParams.WRAP_CONTENT, ViewGroup.LayoutParams.WRAP_CONTENT);
  //popupWindow
  popupWindow.setFocusable(true);
  popupWindow.setOutsideTouchable(false);
  popupWindow.setBackgroundDrawable(null);
  popupWindow.getContentView().setFocusable(true); // 这个很重要
  popupWindow.getContentView().setFocusableInTouchMode(true);
  popupWindow.getContentView().setOnKeyListener(new View.OnKeyListener() {
    @Override
    public boolean onKey(View v, int keyCode, KeyEvent event) {
      if (keyCode == KeyEvent.KEYCODE_BACK) {
        popupWindow.dismiss();
        return true;
      }
      return false;
    }
  });
  popupWindow.showAsDropDown(mButton1, 0, 10);
}

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

mPopupWindow.getContentView().measure(View.MeasureSpec.UNSPECIFIED, View.MeasureSpec.UNSPECIFIED);
mWidth = mPopupWindow.getContentView().getMeasuredWidth();
mHeight = mPopupWindow.getContentView().getMeasuredHeight();
mPopupWindow.setBackgroundDrawable(null);
mPopupWindow.getContentView().setFocusable(true);
mPopupWindow.getContentView().setFocusableInTouchMode(true);
mPopupWindow.getContentView().setOnKeyListener(new View.OnKeyListener() {
  @Override
  public boolean onKey(View v, int keyCode, KeyEvent event) {

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

mPopupWindow.setBackgroundDrawable(null);
mPopupWindow.getContentView().setFocusable(true);
mPopupWindow.getContentView().setFocusableInTouchMode(true);
mPopupWindow.getContentView().setOnKeyListener(new View.OnKeyListener() {
  @Override
  public boolean onKey(View v, int keyCode, KeyEvent event) {

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

public void showPopup() {
 LayoutInflater li = LayoutInflater.from(getActivity()); 
 View v = li.inflate(R.layout.popup, null); 
 PopupWindow window = new PopupWindow(v, width, height); 
 Veiw popupView = window.getContentView();
 edtTitle = (EditText) popupView.findViewById(R.id.edtTitle);
}

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

//Linking the variables
minionClick = (Button) findViewById(R.id.minioncentreid);
storeClick = (Button) findViewById(R.id.storeimageid);
textGoldCount = (TextView) findViewById(R.id.textviewtop);

//Initialize variables from popup window
 LayoutInflater inflater = (LayoutInflater)
    this.getSystemService(Context.LAYOUT_INFLATER_SERVICE);
PopupWindow pw = new PopupWindow(
      inflater.inflate(R.layout.storemenu, null, false), 
storeDismiss = pw.getContentView().findViewById(R.id.menudismissid);

代码示例来源:origin: skydoves/PowerMenu

/**
 * gets the content view of the popup menu.
 *
 * @return content view of the popup menu.
 */
protected View getMeasuredContentView() {
  View contentView = menuWindow.getContentView();
  contentView.measure(
      View.MeasureSpec.makeMeasureSpec(0, View.MeasureSpec.UNSPECIFIED),
      View.MeasureSpec.makeMeasureSpec(0, View.MeasureSpec.UNSPECIFIED));
  return contentView;
}

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

public void onScrollStateChanged(AbsListView view, int scrollState) {
    if (scrollState == SCROLL_STATE_TOUCH_SCROLL &&
        !isInputMethodNotNeeded() && mPopup.getContentView() != null) {
      mHandler.removeCallbacks(mResizePopupRunnable);
      mResizePopupRunnable.run();
    }
  }
}

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

LayoutInflater inflater = (LayoutInflater) SettingActivity.this.getSystemService(SettingActivity.LAYOUT_INFLATER_SERVICE); 
     PopupWindow pw = new PopupWindow(inflater.inflate(R.layout.gd_quick_action_slide_fontsize, null),LayoutParams.MATCH_PARENT,LayoutParams.MATCH_PARENT, true);
     pw.showAtLocation(SettingActivity.this.findViewById(R.id.setting_fontsize), Gravity.CENTER, 0, 0);
     View v= pw.getContentView();
     TextView tv=v.findViewById(R.id.....);

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

public void showPopView(){
  if (mPopupWindow.getContentView() != mViewLists.get(mSelectPosition)) {
    mPopupWindow.setContentView(mViewLists.get(mSelectPosition));
  }
  mPopupWindow.showAsDropDown(this, 0, 0);
}

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

public void onClick(View v) {
    LinearLayout menu = (LinearLayout) mAttachmentMenu.getContentView();
    menu.measure(MeasureSpec.makeMeasureSpec(0, MeasureSpec.UNSPECIFIED), MeasureSpec.makeMeasureSpec(0, MeasureSpec.UNSPECIFIED));
    mAttachmentMenu.showAsDropDown(v, 0, -menu.getMeasuredHeight() - v.getHeight());
  }
});

代码示例来源:origin: com.squareup.assertj/assertj-android

public PopupWindowAssert hasContentView(View view) {
 isNotNull();
 View actualView = actual.getContentView();
 assertThat(actualView) //
   .overridingErrorMessage("Expected content view <%s> but was <%s>.", view, actualView) //
   .isSameAs(view);
 return this;
}

代码示例来源:origin: Dawish/BriskTVLauncher

protected void showPpWindow(){
  if(contentView != null){
    if(!ppWindow.isShowing()){
      ppWindow.showAtLocation(contentView, Gravity.BOTTOM, 0, 0);
      ppWindow.getContentView().requestFocus();
    }else {
      ppWindow.dismiss();
    }
  }
  else {
  }
}

代码示例来源:origin: Dawish/BriskTVLauncher

protected void initPpWindow(){
    contentView = findViewById(R.id.layoutContent);
    View popView = LayoutInflater.from(this).inflate(R.layout.layout_popupwindow ,null ,false);
    ppWindow = new PopupWindow(popView , ViewGroup.LayoutParams.MATCH_PARENT ,getWindowManager().getDefaultDisplay().getHeight()/5);
    ppWindow.setAnimationStyle(R.style.popwin_anim_style);
    ppWindow.setFocusable(true);
    ppWindow.setBackgroundDrawable(getResources().getDrawable(R.drawable.shape_popupwindow_bg));
//        UIUtils.setPopupWindowTouchModal(ppWindow, false);
    ((ViewGroup)ppWindow.getContentView()).setDescendantFocusability(ViewGroup.FOCUS_AFTER_DESCENDANTS);
  }

相关文章