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

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

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

PopupWindow.setTouchInterceptor介绍

暂无

代码示例

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

view.setLayoutParams(new ViewGroup.MarginLayoutParams(ViewGroup.LayoutParams.MATCH_PARENT, ViewGroup.LayoutParams.MATCH_PARENT));
popupWindow.setContentView(view);
popupWindow.setTouchInterceptor((v, event) -> {
  popupWindow.dismiss();
  ViewGroup rootView = (ViewGroup) getRootView();

代码示例来源: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.setTouchInterceptor(new View.OnTouchListener() {
  @Override
  public boolean onTouch(View v, MotionEvent event) {

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

/**
 * sets {@link android.view.View.OnTouchListener} manually for the outside of popup.
 *
 * @param onTouchListener onTouchListener.
 */
public void setTouchInterceptor(View.OnTouchListener onTouchListener) {
  this.menuWindow.setTouchInterceptor(onTouchListener);
}

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

mPopupWindow.setTouchInterceptor(new View.OnTouchListener() {
  @Override
  public boolean onTouch(View v, MotionEvent event) {

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

/**
 * Constructor.
 * 
 * @param context Context
 */
public PopupWindows(Context context) {
  mContext    = context;
  mWindow     = new PopupWindow(context);
  mWindow.setTouchInterceptor(new OnTouchListener() {
    @Override
    public boolean onTouch(View v, MotionEvent event) {
      if (event.getAction() == MotionEvent.ACTION_OUTSIDE) {
        mWindow.dismiss();
        
        return true;
      }
      
      return false;
    }
  });
  mWindowManager = (WindowManager) context.getSystemService(Context.WINDOW_SERVICE);
}

代码示例来源:origin: Meituan-Dianping/Shield

popupWindow.setTouchInterceptor(new View.OnTouchListener() {
  @Override
  public boolean onTouch(View v, MotionEvent event) {

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

actionBarImg.setOnClickListener(new OnClickListener() {
    public void onClick(View view) {
       LayoutInflater inflater =  getLayoutInflater();
       View layout = inflater.inflate(R.layout.cart_layout, null);
       PopupWindow pw = new PopupWindow(layout , LinearLayout.LayoutParams.WRAP_CONTENT,
           LinearLayout.LayoutParams.WRAP_CONTENT, true);
       // display the popup in the center
       pw.setOutsideTouchable(true);
       pw.setBackgroundDrawable(new ColorDrawable(android.R.color.transparent));
       pw.setFocusable(true);
       pw.setTouchInterceptor(new OnTouchListener() {
         @Override
         public boolean onTouch(View v, MotionEvent event) {
           Log.i("touch ", "touch");
           if (event.getAction() == MotionEvent.ACTION_OUTSIDE) {
             Log.i("touch outside", "touch outside");
             pw.dismiss();
             return true;
           }
           return false;
         }
       });
       pw.showAsDropDown(v);
     }
  });

代码示例来源:origin: PopFisher/SmartPopupWindow

popupWindow.setTouchInterceptor(new View.OnTouchListener() {
  @Override
  public boolean onTouch(View v, MotionEvent event) {

代码示例来源:origin: byhieg/easyweather

@Override
public void showPopupWindow() {
  View contentView = LayoutInflater.from(getActivity()).inflate(R.layout.item_popupwindow, null);
  LinearLayout del = (LinearLayout) contentView.findViewById(R.id.del);
  ListView listView = (ListView) contentView.findViewById(R.id.popup_listview);
  PopupWindowAdapter adapter = new PopupWindowAdapter(hoursWeathers, getActivity());
  listView.setAdapter(adapter);
  adapter.notifyDataSetChanged();
  final PopupWindow popupWindow = new PopupWindow(contentView,
      LinearLayout.LayoutParams.MATCH_PARENT,
      LinearLayout.LayoutParams.MATCH_PARENT,
      true);
  popupWindow.setTouchable(true);
  popupWindow.setTouchInterceptor(new View.OnTouchListener() {
    @Override
    public boolean onTouch(View v, MotionEvent event) {
      return false;
    }
  });
  popupWindow.setBackgroundDrawable(ContextCompat.getDrawable(getActivity(), R.color.transparent));
  popupWindow.showAtLocation(rootLayout,Gravity.CENTER ,0, 0);
  del.setOnClickListener(new View.OnClickListener() {
    @Override
    public void onClick(View v) {
      popupWindow.dismiss();
    }
  });
}

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

popup.setTouchInterceptor(new OnTouchListener() {

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

pw.setTouchInterceptor(new View.OnTouchListener() {
  @Override
  public boolean onTouch(View v, MotionEvent event) {

代码示例来源:origin: lizhifeng-sky/VideoEdit

LinearLayout.LayoutParams.WRAP_CONTENT, LinearLayout.LayoutParams.WRAP_CONTENT, true);
popupWindow.setTouchable(true);
popupWindow.setTouchInterceptor(new View.OnTouchListener() {
  @Override
  public boolean onTouch(View v, MotionEvent event) {

代码示例来源:origin: rocky0116/orderDishes

getCart(popuListView);
popupWindow.setFocusable(true);
popupWindow.setTouchInterceptor(new View.OnTouchListener() {

代码示例来源:origin: lizhifeng-sky/VideoEdit

LinearLayout.LayoutParams.WRAP_CONTENT, LinearLayout.LayoutParams.WRAP_CONTENT, true);
popupWindow.setTouchable(true);
popupWindow.setTouchInterceptor(new View.OnTouchListener() {
  @Override
  public boolean onTouch(View v, MotionEvent event) {

代码示例来源:origin: ZhuoKeTeam/QPM

ViewGroup.LayoutParams.WRAP_CONTENT, ViewGroup.LayoutParams.MATCH_PARENT, true);
popupWindow.setTouchable(true);
popupWindow.setTouchInterceptor(new View.OnTouchListener() {

代码示例来源:origin: hymanme/MaterialHome

mPopupWindow.setTouchInterceptor(new View.OnTouchListener() {
  @Override
  public boolean onTouch(View v, MotionEvent event) {

代码示例来源:origin: supertaohaili/book

/**
 * 添加一些属性设置
 * @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: supertaohaili/book

mPopupWindow.setTouchInterceptor(new View.OnTouchListener() {
  @Override
  public boolean onTouch(View v, MotionEvent event) {

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

mPopup.setTouchInterceptor(mTouchInterceptor);
mPopup.showAsDropDown(mDropDownAnchorView,
    mDropDownHorizontalOffset, mDropDownVerticalOffset);

相关文章