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


Java PopupWindow.setFocusable方法代码示例

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


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

示例1: createPopupWindow

import android.widget.PopupWindow; //导入方法依赖的package包/类
/**
 * 创建PopupWindow选择提示框
 *
 * @param activity   当前Activity
 * @param targetView 与提示框关联的控件
 * @param width      提示框宽
 * @param height     提示框高
 */
private static void createPopupWindow(Activity activity, View targetView,
                                      int width, int height) {
    popupWindowDismiss();

    //通过布局注入器,注入布局给View对象
    if (view != null) {
        view = null;
    }
    view = activity.getLayoutInflater().inflate(R.layout.layout_popup_window, null);
    //通过view和宽·高,构造popupWindow
    popupWindow = new PopupWindow(view, width, height);
    popupWindow.setFocusable(true);
    //popupWindow.setBackgroundDrawable(new BitmapDrawable());
    //设置window视图的位置
    popupWindow.showAsDropDown(targetView);
}
 
开发者ID:alidili,项目名称:Demos,代码行数:25,代码来源:ShowUtils.java

示例2: test

import android.widget.PopupWindow; //导入方法依赖的package包/类
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);
}
 
开发者ID:weiwenqiang,项目名称:GitHub,代码行数:25,代码来源:MainActivity.java

示例3: showActionMenu

import android.widget.PopupWindow; //导入方法依赖的package包/类
/**
 * 长按弹出菜单
 *
 * @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() {
            // 清理已选的文字
            clearSelectedTextBackground();
        }
    });
}
 
开发者ID:devilist,项目名称:AdvancedTextView,代码行数:25,代码来源:VerticalTextView.java

示例4: 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

示例5: initStokeWidthPopWindow

import android.widget.PopupWindow; //导入方法依赖的package包/类
private void initStokeWidthPopWindow() {
    popView = LayoutInflater.from(activity).
            inflate(R.layout.view_set_stoke_width, null);
    setStokenWidthWindow = new PopupWindow(popView, ViewGroup.LayoutParams.MATCH_PARENT,
            ViewGroup.LayoutParams.WRAP_CONTENT);

    mStokenWidthSeekBar = (SeekBar) popView.findViewById(R.id.stoke_width_seekbar);

    setStokenWidthWindow.setFocusable(true);
    setStokenWidthWindow.setOutsideTouchable(true);
    setStokenWidthWindow.setBackgroundDrawable(new BitmapDrawable());
    setStokenWidthWindow.setAnimationStyle(R.style.popwin_anim_style);


    mPaintModeView.setPaintStrokeColor(Color.RED);
    mPaintModeView.setPaintStrokeWidth(10);

    updatePaintView();
}
 
开发者ID:viseator,项目名称:MontageCam,代码行数:20,代码来源:PaintFragment.java

示例6: show

import android.widget.PopupWindow; //导入方法依赖的package包/类
private void show() {
    RecyclerView recyclerView = new RecyclerView(getContext());
    recyclerView.setLayoutParams(new ViewGroup.LayoutParams(ViewGroup.LayoutParams.WRAP_CONTENT, ViewGroup.LayoutParams.WRAP_CONTENT));
    recyclerView.setHasFixedSize(true);
    recyclerView.setLayoutManager(new LinearLayoutManager(getContext(), LinearLayoutManager.VERTICAL, false));
    recyclerView.setAdapter(adapter);

    popupWindow = new PopupWindow(recyclerView, ViewGroup.LayoutParams.WRAP_CONTENT, ViewGroup.LayoutParams.WRAP_CONTENT);
    popupWindow.setOutsideTouchable(true);
    popupWindow.setFocusable(true);
    popupWindow.showAsDropDown(this);
    popupWindow.setOnDismissListener(new PopupWindow.OnDismissListener() {

        @Override
        public void onDismiss() {
            if (onItemSelectedListener != null) {
                onItemSelectedListener.onNothingSelected();
            }
            dismiss();
        }
    });
}
 
开发者ID:IstiN,项目名称:android-training-2017,代码行数:23,代码来源:CustomSpinner.java

示例7: OverflowHelper

import android.widget.PopupWindow; //导入方法依赖的package包/类
public OverflowHelper(Context ctx) {
    mContext = ctx;
    mNormalColor = mContext.getResources().getColor(R.color.white);
    mDisabledColor = mContext.getResources().getColor(R.color.text_disabled);
    mPopupLayout = (LinearLayout) LayoutInflater.from(mContext).inflate(R.layout.comm_popup_menu, null, true);
    mListView = (PopupMenuListView) mPopupLayout.findViewById(R.id.comm_popup_list);
    mAdapter = new OverflowAdapter(this, ctx);
    mListView.setAdapter(mAdapter);
    mListView.setOnKeyListener(mOnKeyListener);
    mPopupWindow = new PopupWindow(mPopupLayout, -2, -2, true);
    mPopupWindow.setContentView(mPopupLayout);
    mPopupWindow.setOutsideTouchable(true);
    mPopupWindow.setFocusable(true);
    mPopupWindow.setWidth(414);
    mPopupWindow.getContentView().setOnTouchListener(mOnTouchListener);
    mPopupWindow.update();
}
 
开发者ID:Louis19910615,项目名称:youkes_browser,代码行数:18,代码来源:OverflowHelper.java

示例8: progressPopUp

import android.widget.PopupWindow; //导入方法依赖的package包/类
@SuppressWarnings("deprecation")
public void  progressPopUp(final Activity context,String data){
	
	RelativeLayout layoutId = (RelativeLayout)context.findViewById(R.id.dialog_rootView);
	LayoutInflater layoutInflater  = (LayoutInflater)context.getSystemService(Context.LAYOUT_INFLATER_SERVICE);
	View layout = layoutInflater.inflate(R.layout.progresspopup, layoutId);
	txtWaiting = (TextView)layout.findViewById(R.id.txtWaiting);

	paymentAlert = new PopupWindow(context);
	paymentAlert.setContentView(layout);		
	paymentAlert.setHeight(WindowManager.LayoutParams.MATCH_PARENT);		
	paymentAlert.setWidth(WindowManager.LayoutParams.MATCH_PARENT);
	paymentAlert.setFocusable(true);		
	paymentAlert.setBackgroundDrawable(new BitmapDrawable());
	paymentAlert.showAtLocation(layout, Gravity.CENTER, 0, 0);	
	if(data !=null)
		txtWaiting.setText(data);
   }
 
开发者ID:mityung,项目名称:XERUNG,代码行数:19,代码来源:ProgressDialog.java

示例9: initPopupWindow

import android.widget.PopupWindow; //导入方法依赖的package包/类
/**
 * 初始化显示文件夹信息的popupWindow
 */
private void initPopupWindow() {
    popRecyclerview = new RecyclerView(this);
    popRecyclerview.setBackgroundColor(getResources().getColor(android.R.color.white));
    LinearLayoutManager layoutManager = new LinearLayoutManager
            (this, LinearLayoutManager.VERTICAL, false);
    popRecyclerview.setLayoutManager(layoutManager);
    popRecyclerview.addItemDecoration(new DividerItemDecoration(this, DividerItemDecoration.VERTICAL_LIST));
    popRecyclerview.setPadding(0, Commonutil.dp2px(this, 5), 0, 0);

    int screenHeight = getResources().getDisplayMetrics().heightPixels;

    popupWindow = new PopupWindow(popRecyclerview, ViewGroup.LayoutParams.MATCH_PARENT,
            (int) (screenHeight * 0.6f));

    popupWindow.setBackgroundDrawable(new BitmapDrawable());
    popupWindow.setFocusable(true);
    popupWindow.setOutsideTouchable(false);
    popupWindow.setAnimationStyle(R.style.popup_anim);

    popupWindow.setOnDismissListener(new PopupWindow.OnDismissListener() {
        @Override
        public void onDismiss() {
            fab.setVisibility(View.VISIBLE);
            WindowManager.LayoutParams attributes =
                    ScanImagesActivity.this.getWindow().getAttributes();
            attributes.alpha = 1;
            ScanImagesActivity.this.getWindow().setAttributes(attributes);
        }
    });

}
 
开发者ID:BittleDragon,项目名称:MyRepository,代码行数:35,代码来源:ScanImagesActivity.java

示例10: startShowDialog

import android.widget.PopupWindow; //导入方法依赖的package包/类
private void startShowDialog() {
    View popMenuView = activity.getLayoutInflater().inflate(R.layout.dialog, null);
    RealTimeBlurView blur_view = (RealTimeBlurView) popMenuView.findViewById(R.id.blur_view);
    float v = TypedValue.applyDimension(TypedValue.COMPLEX_UNIT_DIP, 15, activity.getResources().getDisplayMetrics());
    blur_view.setBlurRadius(v);
    final PopupWindow popMenu = new PopupWindow(popMenuView, RelativeLayout.LayoutParams.MATCH_PARENT, RelativeLayout.LayoutParams.MATCH_PARENT, true);
    popMenu.setClippingEnabled(false);
    popMenu.setFocusable(true);         //点击其他地方关闭
    popMenu.setAnimationStyle(R.style.main_menu_animstyle);
    popMenu.showAtLocation(popMenuView, Gravity.BOTTOM | Gravity.CENTER_HORIZONTAL, 0, 0);
}
 
开发者ID:yangchong211,项目名称:YCUtils,代码行数:12,代码来源:KnowledgeCustomFragment.java

示例11: initCirclePop

import android.widget.PopupWindow; //导入方法依赖的package包/类
private void initCirclePop() {
    View view = LayoutInflater.from(this).inflate(R.layout.layout_circle_comment, null);
    mCiclePop = new PopupWindow(view, ViewGroup.LayoutParams.WRAP_CONTENT, ViewGroup.LayoutParams.WRAP_CONTENT);
    mCiclePop.setAnimationStyle(R.style.CirclePopAnim);
    mCiclePop.setFocusable(true);
    mCiclePop.setBackgroundDrawable(new ColorDrawable(Color.TRANSPARENT));
    mCiclePop.setOutsideTouchable(true);
}
 
开发者ID:weiwenqiang,项目名称:GitHub,代码行数:9,代码来源:BasicActivity.java

示例12: initFloatingWindow

import android.widget.PopupWindow; //导入方法依赖的package包/类
private void initFloatingWindow() {
  mWindow = new PopupWindow(mContext);
  mWindow.setFocusable(false);
  mWindow.setBackgroundDrawable(null);
  mWindow.setOutsideTouchable(true);
  mAnimStyle = android.R.style.Animation;
}
 
开发者ID:Leavessilent,项目名称:QuanMinTV,代码行数:8,代码来源:MediaController.java

示例13: initFloatingWindow

import android.widget.PopupWindow; //导入方法依赖的package包/类
private void initFloatingWindow() {
    mWindow = new PopupWindow(mContext);
    mWindow.setFocusable(false);
    mWindow.setBackgroundDrawable(null);
    mWindow.setOutsideTouchable(true);
    mAnimStyle = android.R.style.Animation;
}
 
开发者ID:pili-engineering,项目名称:PLDroidShortVideo,代码行数:8,代码来源:MediaController.java

示例14: buildPopupWindow

import android.widget.PopupWindow; //导入方法依赖的package包/类
private PopupWindow buildPopupWindow(Activity parent) {
    LayoutInflater inflater = (LayoutInflater) parent.getSystemService(Context.LAYOUT_INFLATER_SERVICE);
    ViewGroup popupViewGroup = parent.findViewById(R.id.popup_layout);
    View popupView = inflater.inflate(R.layout.progress_popup_window, popupViewGroup);

    PopupWindow popupWindow = new PopupWindow(popupView, 750, 350, true);
    popupWindow.setBackgroundDrawable(new ColorDrawable(Color.WHITE));
    popupWindow.setElevation(10);
    popupWindow.setFocusable(false);
    popupWindow.showAtLocation(popupView, Gravity.CENTER, 0, 0);
    return popupWindow;
}
 
开发者ID:stevesoltys,项目名称:backup,代码行数:13,代码来源:CreateBackupActivityController.java

示例15: MenuPopup

import android.widget.PopupWindow; //导入方法依赖的package包/类
public MenuPopup(Context context, int resId){
    View view=LayoutInflater.from(context).inflate(resId, null,false);
    mWindow = new PopupWindow(view, ViewGroup.LayoutParams.WRAP_CONTENT, ViewGroup.LayoutParams.WRAP_CONTENT);
    mWindow.setFocusable(true);
    mWindow.setOutsideTouchable(true);
    mWindow.setBackgroundDrawable(new ColorDrawable(0x00ffffff));
}
 
开发者ID:ccwant,项目名称:ActionBarModular,代码行数:8,代码来源:MenuPopup.java


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