PopupWindow常见问题
来源:互联网 发布:python算t统计量 编辑:程序博客网 时间:2024/05/20 14:19
- popup点击外部或返回键取消
//popupwindow点击外部和返回键消失mPopup.setFocusable(true);//如果没有这句返回键后窗体泄露ColorDrawable dw = new ColorDrawable(0x00000000);mPopup.setBackgroundDrawable(dw);mPopup.setOutsideTouchable(true);//外部有焦点
- showAsDropDown(v, offsetX, offsetY)设置popup的位置 offsetX失效;原因:popup默认是左下角对其,如果控件是靠右边的,offsetX的设置是关键点。给出代码:
/** * 显示popup * @param view 在这个view下显示 * @param activity 在这个activity上显示pop */ @SuppressLint("NewApi")public static void showPopup(View view, Activity activity) {LayoutInflater inflater = LayoutInflater.from(activity);View popupView = inflater.inflate(R.layout.pop_clear_waitapply, null);PopupWindow mPopup = new PopupWindow(popupView, LayoutParams.WRAP_CONTENT, LayoutParams.WRAP_CONTENT);//mPopup.setBackgroundDrawable(new BitmapDrawable());mPopup.setFocusable(true);ColorDrawable dw = new ColorDrawable(0x00000000);mPopup.setBackgroundDrawable(dw);mPopup.setOutsideTouchable(true);popupView.measure(View.MeasureSpec.UNSPECIFIED, View.MeasureSpec.UNSPECIFIED);int xOffset = -(popupView.getMeasuredWidth() - view.getWidth());mPopup.showAsDropDown(view, xOffset, -14);//popup默认左下角对齐//mPopup.showAtLocation(view, Gravity.NO_GRAVITY, -40, 10);}
1 0
- PopupWindow常见问题
- popupwindow
- popupWindow
- PopupWindow
- PopupWindow
- PopupWindow
- PopupWindow
- PopupWindow
- popupwindow
- PopupWindow
- PopupWindow
- PopupWindow
- PopupWindow
- PopupWindow
- PopupWindow
- PopupWindow
- popupwindow
- popupwindow
- Tomcat version 6.0 only supports J2EE 1.2, 1.3, 1.4, and Java EE 5 Web modules
- 飞机界面设置
- 【FAQ】ubuntu:java opensdk 7 如何升级到 8?
- 习题8-12 UVA - 1153 Keep the Customer Satisfied 顾客是上帝(优先队列贪心)
- java语言基础入门——运算符的介绍
- PopupWindow常见问题
- block使用
- extern作用详解
- POJ3616 Milking Time(DP:最大子段和)
- Some file crunching failed, see logs for details
- 欢迎使用Markdown编辑器写博客
- Android中Activity的finish()、destroy()、System.exit()区别
- Mybatis1.0
- sql语句,获取2016年7月份,每日任务数量