android弹出窗口实现
来源:互联网 发布:工信部网站域名查询 编辑:程序博客网 时间:2024/05/01 15:06
/** * popWindow(下拉列表弹出) * @Title: popWindow * @param 设定文件 * @return void 返回类型 */ private void popWindow() { int intMobilePhoneWidth = WindowSizeUtil.getWidth(mContext); int intMobilePhoneHeight = WindowSizeUtil.getHeight(mContext); int popWidth = (int) (intMobilePhoneWidth / 4); //6.40 int popHeight = (int) (intMobilePhoneHeight / 7);//5.80 //15.4 LayoutInflater flater = (LayoutInflater) getSystemService(Context.LAYOUT_INFLATER_SERVICE); popWindowView = flater.inflate(R.layout.common_listview, null); popWindowView.setBackgroundColor(Color.GRAY); popWindowView.setAlpha(255);// 0~255透明度值 lv_popup = (ListView) popWindowView.findViewById(R.id.lv_common); ArrayList<HashMap<String, String>> list = new ArrayList<HashMap<String,String>>(); HashMap<String, String > obj =new HashMap<String, String>(); obj.put("id","jubao"); obj.put("name", "举报"); list.add(obj ); HashMap<String, String > obj1 =new HashMap<String, String>(); obj1.put("id","fuzhi"); obj1.put("name", "复制链接"); list.add(obj1 ); NgPopWindowAdapter adapter = new NgPopWindowAdapter(mContext, list); lv_popup.setAdapter(adapter); popwindow = new PopupWindow(popWindowView,popWidth,popHeight); popwindow.showAsDropDown(btn_jubao); // 使其聚集 popwindow.setFocusable(true); // 设置允许在外点击消失 popwindow.setOutsideTouchable(true); // 这个是为了点击“返回Back”也能使其消失,并且并不会影响你的背景 popwindow.setBackgroundDrawable(new BitmapDrawable()); lv_popup.setOnItemClickListener(new OnItemClickListener() { @Override public void onItemClick(AdapterView<?> arg0, View arg1, int arg2, long arg3) { // TODO Auto-generated method stub Intent intent = new Intent(mContext, ReportActivity.class); if(nGArticleBean!=null){ intent.putExtra(ProjectConstant.INTENT_EXTRA_FRIEND_UCODE, nGArticleBean.getUserCode()); } mContext.startActivity(intent); } }); }
0 0
- android弹出窗口实现
- android弹出窗口的实现
- android弹出窗口的实现(PopupWindow)
- android弹出窗口的实现(PopupWindow)
- android弹出窗口的实现(PopupWindow)
- android弹出窗口的实现(PopupWindow)
- android弹出窗口的实现(PopupWindow)
- android弹出窗口的实现(PopupWindow)!!!!
- Android弹出窗口的实现(PopupWindow)
- android弹出窗口的实现(PopupWindow)
- android弹出窗口的实现(PopupWindow)
- android pop自定义弹出窗口实现
- android弹出窗口的实现(PopupWindow)
- Android Demo---实现从底部弹出窗口
- android弹出窗口的实现(PopupWindow)
- android几种常见弹出窗口实现
- Android弹出窗口的实现(PopupWindow)
- android广播中实现弹出窗口
- 深入理解javascript的原型与闭包
- iOS view的指定角设置圆弧
- 如何解决Android 5.0中出现的警告:Service Intent must be explicit
- OGRE SampleBrowser框架解析
- checkbox框的各种状态选择
- android弹出窗口实现
- Python 私有属性与内部方法
- iOS 常用:点击屏幕和return退出隐藏键盘和解决虚拟键盘挡住UITextField的方法
- Window下让JAR在后台运行的方法
- msql小技巧
- 简单理解Memcached的Slab Allocation
- 01-表单提交的方式
- 01-表单提交的方式
- 表单提交的方式