popupwindow的使用 :

public void onItemClick(AdapterView<?> parent, View view, int position,long id) {/************************** 屏幕适配 ************************************/        int popupWindowWidth = Integer.valueOf(getResources().getString(R.string.popwindowwidth).toString().trim());        int popupWindowHeight = Integer.valueOf(getResources().getString(R.string.popwindowheight).toString().trim());        int dx = Integer.valueOf(getResources().getString(R.string.popwindowdx).toString().trim());        /**********************************************************************/        int[] location = new int[2];        view.getLocationInWindow(location);        int x = location[0] + dx;        int y = location[1];        AppInfo info = (AppInfo) lv_AppManagerAcitivty.getItemAtPosition(position);        View popupWindow = View.inflate(this, R.layout.popwindow, null);        ll_start = (LinearLayout) popupWindow.findViewById(R.id.ll_start);        ll_uninstall = (LinearLayout) popupWindow.findViewById(R.id.ll_uninstall);        ll_share = (LinearLayout) popupWindow.findViewById(R.id.ll_share);        ll_start.setTag(position);        ll_uninstall.setTag(position);        ll_share.setTag(position);        ll_start.setOnClickListener(this);        ll_uninstall.setOnClickListener(this);        ll_share.setOnClickListener(this);        localPopupWindow = new PopupWindow(popupWindow, popupWindowWidth,popupWindowHeight);        Drawable background = getResources().getDrawable(R.drawable.local_popup_bg);//注意:popwindow一定要设置背景   localPopupWindow.setBackgroundDrawable(background);        localPopupWindow.showAtLocation(view, Gravity.LEFT | Gravity.TOP, x, y);}

更多相关文章

  1. Android(安卓)Studio学习:简单控件:滚动显示文本
  2. android maxLines ellipsize 配合使用失效,解决办法
  3. android 对话框
  4. android获取屏幕分辨率
  5. Android填坑记录
  6. Android快速显示4G
  7. Android(安卓)OnTouchListener 触摸事件 & GestureDetector 手势
  8. RecyclerView嵌套ScrollView
  9. Android6.0修改设备设置中kernel信息

随机推荐

  1. 原画设计如何学好?快速入门学习原画设计
  2. 如何练习人体?板绘人体练习技巧!
  3. gimp镜像下载方法
  4. Centos7 安装Redis
  5. node运行原理CPS、模块的导入、常用模块
  6. 【Zabbix】Zabbix网络自动发现
  7. 【PostgreSQL】基于CentOS系统安装Postgr
  8. # 【Zabbix】Zabbix 分布式监控—创建Pro
  9. 线稿怎么正确绘画?零基础学习线稿手绘
  10. mvc架构中 pathinfo路由的解析原理