当前位置: 首页>>代码示例>>Java>>正文


Java PopupWindow.setTouchable方法代码示例

本文整理汇总了Java中android.widget.PopupWindow.setTouchable方法的典型用法代码示例。如果您正苦于以下问题:Java PopupWindow.setTouchable方法的具体用法?Java PopupWindow.setTouchable怎么用?Java PopupWindow.setTouchable使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在android.widget.PopupWindow的用法示例。


在下文中一共展示了PopupWindow.setTouchable方法的13个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的Java代码示例。

示例1: apply

import android.widget.PopupWindow; //导入方法依赖的package包/类
/**
 * 添加一些属性设置
 * @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);



}
 
开发者ID:weiwenqiang,项目名称:GitHub,代码行数:27,代码来源:CustomPopWindow.java

示例2: ListFilePopWindow

import android.widget.PopupWindow; //导入方法依赖的package包/类
public ListFilePopWindow(Context context, View targetView) {
    super();
    this.targetView = targetView;
    View contentView = LayoutInflater.from(context).inflate(R.layout.kf5_list_file_dir, null);
    listView = (ListView) contentView.findViewById(R.id.kf5_list_dir);
    Point point = ScreenUtils.getScreenSize(context);
    int height = (int) (point.y * (4.5f / 8.0f));
    popupWindow = new PopupWindow();
    popupWindow.setWidth(ViewGroup.LayoutParams.MATCH_PARENT);
    popupWindow.setHeight(height);
    popupWindow.setBackgroundDrawable(new BitmapDrawable());
    popupWindow.setOutsideTouchable(true);
    popupWindow.setFocusable(true);
    popupWindow.setTouchable(true);
    popupWindow.setOnDismissListener(new PopupWindow.OnDismissListener() {

        @Override
        public void onDismiss() {
            // TODO Auto-generated method stub
            popupWindow.dismiss();
        }
    });
    popupWindow.setAnimationStyle(R.style.KF5FileListPopAnim);
    popupWindow.setContentView(contentView);
    listView.setOnItemClickListener(this);
}
 
开发者ID:Zyj163,项目名称:yyox,代码行数:27,代码来源:ListFilePopWindow.java

示例3: initView

import android.widget.PopupWindow; //导入方法依赖的package包/类
private void initView() {
    View contentView = LayoutInflater.from(mContext).inflate(R.layout.popup_choose_set, null);
    contentView.findViewById(R.id.ll_shade).setOnClickListener(new View.OnClickListener() {
        @Override
        public void onClick(View v) {
            dismiss();
        }
    });
    mChooseWindow = new PopupWindow(contentView, -1, -1);
    //点击空白处的时候PopupWindow会消失
    mChooseWindow.setFocusable(true);
    mChooseWindow.setTouchable(true);
    mChooseWindow.setOutsideTouchable(true);
    mChooseWindow.setBackgroundDrawable(new ColorDrawable(Color.TRANSPARENT));
    // mChooseWindow.setAnimationStyle(R.style.popupAnim);

    //初始化集数列表
    RecyclerView rvChooseSet = (RecyclerView) contentView.findViewById(R.id.rv_choose_set);
    rvChooseSet.setHasFixedSize(true);
    rvChooseSet.setLayoutManager(new GridLayoutManager(mContext, 4));
    rvChooseSet.setAdapter(new ChooseSetAdapter());
}
 
开发者ID:LingjuAI,项目名称:AssistantBySDK,代码行数:23,代码来源:ChooseSetPopupWindow.java

示例4: apply

import android.widget.PopupWindow; //导入方法依赖的package包/类
private void apply(PopupWindow mPopupWindow) {
    mPopupWindow.setClippingEnabled(this.mClippEnable);
    if(this.mIgnoreCheekPress) {
        mPopupWindow.setIgnoreCheekPress();
    }

    if(this.mInputMode != -1) {
        mPopupWindow.setInputMethodMode(this.mInputMode);
    }

    if(this.mSoftInputMode != -1) {
        mPopupWindow.setSoftInputMode(this.mSoftInputMode);
    }

    if(this.mOnDismissListener != null) {
        mPopupWindow.setOnDismissListener(this.mOnDismissListener);
    }

    if(this.mOnTouchListener != null) {
        mPopupWindow.setTouchInterceptor(this.mOnTouchListener);
    }

    mPopupWindow.setTouchable(this.mTouchable);
}
 
开发者ID:yangchong211,项目名称:YCDialog,代码行数:25,代码来源:CustomPopupWindow.java

示例5: initPopUp

import android.widget.PopupWindow; //导入方法依赖的package包/类
private void initPopUp(){
    popupView = getActivity().getLayoutInflater().inflate(R.layout.popupwindow_city_select, null);
    mPopupWindow = new PopupWindow(popupView, LinearLayout.LayoutParams.MATCH_PARENT, LinearLayout.LayoutParams.WRAP_CONTENT, true);
    mPopupWindow.setTouchable(true);
    mPopupWindow.setOutsideTouchable(true);
    mPopupWindow.setBackgroundDrawable(new BitmapDrawable(getResources(), (Bitmap) null));
    popupView.findViewById(R.id.select_confirm).setOnClickListener(new View.OnClickListener() {
        @Override
        public void onClick(View view) {
            provinceTv.setText(currentProvince.getAreaName());
            cityTv.setText(currentCity.getAreaName());
            countyTv.setText(currentCounty.getAreaName());
            mPopupWindow.dismiss();
        }
    });
}
 
开发者ID:ruiqiao2017,项目名称:Renrentou,代码行数:17,代码来源:CitySelectFragment.java

示例6: showReactionPopup

import android.widget.PopupWindow; //导入方法依赖的package包/类
private void showReactionPopup(View anchorView) {

        ReactionView layout = new ReactionView(MainActivity.this, this);

        int width = LinearLayout.LayoutParams.MATCH_PARENT;
        int height = LinearLayout.LayoutParams.WRAP_CONTENT;
        boolean focusable = true;
        popupWindow = new PopupWindow(layout, width, height, focusable);
        popupWindow.setOutsideTouchable(true);
        popupWindow.setFocusable(true);
        popupWindow.setTouchable(true);

        if (popupWindow != null && popupWindow.isShowing()) {
            popupWindow.dismiss();
        } else {
//            if (android.os.Build.VERSION.SDK_INT >= 24) {
//                int[] a = new int[2];
//                anchorView.getLocationInWindow(a);
//                popupWindow.showAtLocation(getWindow().getDecorView(), Gravity.NO_GRAVITY, 0, a[1] - (anchorView.getHeight() + DisplayUtil.dpToPx(8)));
//            } else {
                popupWindow.showAsDropDown(anchorView, 0, -DisplayUtil.dpToPx(anchorView.getHeight() + DisplayUtil.dpToPx(8)));
//            }


        }
    }
 
开发者ID:saveendhiman,项目名称:FacebookReaction,代码行数:27,代码来源:MainActivity.java

示例7: resultWindow

import android.widget.PopupWindow; //导入方法依赖的package包/类
private PopupWindow resultWindow(View view){
    //View view = LayoutInflater.from(getActivity()).inflate(R.layout.classify_result, null);
    //1.构造一个PopupWindow,参数依次是加载的View,宽高
    final PopupWindow popWindow = new PopupWindow(view,
            400, ViewGroup.LayoutParams.WRAP_CONTENT);
    //final PopupWindow popWindow = new PopupWindow(this.getActivity());
    //popWindow.setAnimationStyle(R.anim.anim_pop);  //设置加载动画

    //这些为了点击非PopupWindow区域,PopupWindow会消失的,如果没有下面的
    //代码的话,你会发现,当你把PopupWindow显示出来了,无论你按多少次后退键
    //PopupWindow并不会关闭,而且退不出程序,加上下述代码可以解决这个问题
    popWindow.setOutsideTouchable(true);
    popWindow.setTouchable(true);
    popWindow.setTouchInterceptor(new View.OnTouchListener() {
        @Override
        public boolean onTouch(View v, MotionEvent event) {
            return false;
            // 这里如果返回true的话,touch事件将被拦截
            // 拦截后 PopupWindow的onTouchEvent不被调用,这样点击外部区域无法dismiss
        }
    });
    popWindow.setBackgroundDrawable(new ColorDrawable(0x11111111));    //要为popWindow设置一个背景才有效
    //设置popupWindow显示的位置
    popWindow.showAtLocation(view, Gravity.CENTER, 0, 0);
    return popWindow;
}
 
开发者ID:lupwei,项目名称:Croprotector,代码行数:27,代码来源:Shoot_fragment.java

示例8: getPopupWindow

import android.widget.PopupWindow; //导入方法依赖的package包/类
private PopupWindow getPopupWindow(View popupView) {
    PopupWindow mPopupWindow = new PopupWindow(popupView, LayoutParams.WRAP_CONTENT, LayoutParams.WRAP_CONTENT, true);
    mPopupWindow.setTouchable(true);
    mPopupWindow.setOutsideTouchable(true);
    mPopupWindow.setBackgroundDrawable(new ColorDrawable(0));
    mPopupWindow.setAnimationStyle(R.style.jc_popup_toast_anim);
    return mPopupWindow;
}
 
开发者ID:tohodog,项目名称:QSVideoPlayer,代码行数:9,代码来源:DemoQSVideoView.java

示例9: setPopWindow

import android.widget.PopupWindow; //导入方法依赖的package包/类
/**
 * 获取弹出视图
 *
 * @return
 */
public void setPopWindow() {
    ListView lv = new ListView(context);
    LinearLayout.LayoutParams lp = new LinearLayout.LayoutParams(DensityUtil.dip2px(context, 150), ViewGroup.LayoutParams.WRAP_CONTENT);
    lp.setMargins(15, 0, 15, 15);
    lv.setLayoutParams(lp);
    lv.setBackgroundColor(Color.WHITE);
    if (Build.VERSION.SDK_INT >= Build.VERSION_CODES.LOLLIPOP) {
        lv.setElevation(15);
    }
    lv.setAdapter(new IconAdapter());
    lv.setOnItemClickListener(this);

    LinearLayout ll = new LinearLayout(context);
    ll.setLayoutParams(new ViewGroup.LayoutParams(DensityUtil.dip2px(context, 200), ViewGroup.LayoutParams.WRAP_CONTENT));
    ll.addView(lv);
    pop = new PopupWindow(ll, ViewGroup.LayoutParams.WRAP_CONTENT, ViewGroup.LayoutParams.WRAP_CONTENT, true);
    pop.setTouchable(true);
    pop.setOutsideTouchable(true);
    //必须添加背景,否则点击空白无法自动隐藏
    pop.setBackgroundDrawable(new BitmapDrawable());
    pop.setOnDismissListener(new PopupWindow.OnDismissListener() {
        @Override
        public void onDismiss() {
            if (changedListener != null) {
                changedListener.onHide(FrmPopMenu.this);
            }
        }
    });
}
 
开发者ID:quickhybrid,项目名称:quickhybrid-android,代码行数:35,代码来源:FrmPopMenu.java

示例10: showPop

import android.widget.PopupWindow; //导入方法依赖的package包/类
private void showPop() {
        final PopupWindow popupWindow = new PopupWindow(this,null,R.style.bottomDialog);
        View view = LayoutInflater.from(this).inflate(R.layout.popup, null);
        popupWindow.setContentView(view);

        popupWindow.setWidth(ViewGroup.LayoutParams.WRAP_CONTENT);
        popupWindow.setHeight(ViewGroup.LayoutParams.WRAP_CONTENT);

        popupWindow.setOutsideTouchable(true);
        popupWindow.setTouchable(true);

//                popupWindow.setAnimationStyle(R.style.);

        popupWindow.setBackgroundDrawable(new ColorDrawable(Color.parseColor("#88000000")));
//                popupWindow.showAsDropDown(mButton7, 0, -mButton7.getHeight());//在view下方

        //如果是0,0的话,默认是在这个view(anchor锚)的左下角作为起始点
        //Gravity.RIGHT代表在view的右下角开始 这个是api19开始支持


        //这种显示方式如果是和view无关,里面只是为了获得token
        popupWindow.showAtLocation(mButton7, Gravity.BOTTOM|Gravity.LEFT,100,200);
        //这个x y的位置是先计算重力所在的位置,然后再以那个位置为左上角,x,y是相对位置

        //如果是Gravity.BOTTOM   设置y值不能为负值
        //设置了重力后坐标系的方向就变了,如果是Gravity.BOTTOM 那么y轴的方向就是向上
    }
 
开发者ID:pop1234o,项目名称:BestPracticeApp,代码行数:28,代码来源:MainPopUpWindowActivity.java

示例11: showTip

import android.widget.PopupWindow; //导入方法依赖的package包/类
public PopupWindow showTip(View anchorView, String txt) {
    final View contentView = LayoutInflater.from(anchorView.getContext()).inflate(R.layout.popup_empty_content_layout, null);
    if (txt != null) {
        TextView tipTv = (TextView) contentView.findViewById(R.id.toast_txt_tv);
        tipTv.setText(txt);
    }
    final PopupWindow popupWindow = new PopupWindow(contentView,
            ViewGroup.LayoutParams.MATCH_PARENT, ViewGroup.LayoutParams.WRAP_CONTENT, true);
    popupWindow.setAnimationStyle(R.style.PopupAnimation);
    popupWindow.setTouchable(false);
    popupWindow.showAsDropDown(anchorView);
    return popupWindow;
}
 
开发者ID:sieml,项目名称:CalendarCheck,代码行数:14,代码来源:MainActivity.java

示例12: createPopWindow

import android.widget.PopupWindow; //导入方法依赖的package包/类
private void createPopWindow(Context context, int type) {
    if (mContext != context) {
        mContext = context;
        popWindow = new PopupWindow(createContentView(type), -1, -2, true);
        popWindow.setTouchable(true);
        popWindow.setOutsideTouchable(true);
        inAnim = AnimationUtils.loadAnimation(mContext, R.anim.s);
    }
}
 
开发者ID:JackChan1999,项目名称:boohee_v5.6,代码行数:10,代码来源:CheckAccountPopwindow.java

示例13: resultWindow_1

import android.widget.PopupWindow; //导入方法依赖的package包/类
private PopupWindow resultWindow_1(View view,String text){
    //View view = LayoutInflater.from(getActivity()).inflate(R.layout.classify_result, null);
    //1.构造一个PopupWindow,参数依次是加载的View,宽高
    final PopupWindow popWindow = new PopupWindow(view,
            400, ViewGroup.LayoutParams.WRAP_CONTENT);
    TextView result=(TextView)view.findViewById(R.id.classify_result_text);
    result.setText(text);
    //final PopupWindow popWindow = new PopupWindow(this.getActivity());
    //popWindow.setAnimationStyle(R.anim.anim_pop);  //设置加载动画

    //这些为了点击非PopupWindow区域,PopupWindow会消失的,如果没有下面的
    //代码的话,你会发现,当你把PopupWindow显示出来了,无论你按多少次后退键
    //PopupWindow并不会关闭,而且退不出程序,加上下述代码可以解决这个问题
    popWindow.setOutsideTouchable(true);
    popWindow.setTouchable(true);
    popWindow.setTouchInterceptor(new View.OnTouchListener() {
        @Override
        public boolean onTouch(View v, MotionEvent event) {
            return false;
            // 这里如果返回true的话,touch事件将被拦截
            // 拦截后 PopupWindow的onTouchEvent不被调用,这样点击外部区域无法dismiss
        }
    });
    popWindow.setBackgroundDrawable(new ColorDrawable(0x11111111));    //要为popWindow设置一个背景才有效
    //设置popupWindow显示的位置
    popWindow.showAtLocation(view, Gravity.CENTER, 0, 0);
    return popWindow;
}
 
开发者ID:lupwei,项目名称:Croprotector,代码行数:29,代码来源:Shoot_fragment.java


注:本文中的android.widget.PopupWindow.setTouchable方法示例由纯净天空整理自Github/MSDocs等开源代码及文档管理平台,相关代码片段筛选自各路编程大神贡献的开源项目,源码版权归原作者所有,传播和使用请参考对应项目的License;未经允许,请勿转载。