private PopupWindow pop;
   
 //弹出气泡PopupWindow//                 TextView contentview=new TextView(getApplicationContext());//                 contentview.setText(info.getPackname());                 //自定义的布局                 View  contentview=View.inflate(getApplicationContext(),R.layout.popup_ruanjianmanager_item,null);                 if(pop!=null&&pop.isShowing()){//吧旧的弹出窗体关闭掉                     pop.dismiss();                     pop=null;                 }                 pop = new PopupWindow(contentview,-2,-2);//-2 是包裹内容,-1 是填充父窗体
pop.setBackgroundDrawable(new ColorDrawable(android.R.color.transparent));//透明背景
//箭头指向左边和上边,间隔0 int[] location=new int[2]; view.getLocationInWindow(location);// pop.showAtLocation(adapterView, Gravity.LEFT|Gravity.TOP,location[0],location[1]); pop.showAtLocation(adapterView, Gravity.LEFT|Gravity.TOP,60,location[1]);
在滑动listview中清除气泡:
   
if(pop!=null&&pop.isShowing()){//吧旧的弹出窗体关闭掉    pop.dismiss();    pop=null;}
在activity销毁时清除气泡:(因为气泡是显示在activity上的)
   

注意事项:popwindow 上加动画时,必须给popwindow加上background,否则动画不生效;

更多相关文章

  1. android地图获取当前位置,气泡标志,点击气泡跳转到另一个界面
  2. Android 可随意拖动的悬浮窗体
  3. [Android] Android Tweened Animations动画使用详解二
  4. 动画学习笔记-Android Animation
  5. Android编程示例之——横竖屏切换动画
  6. Android 同时播放缩放动画和位移动画 时, 位移的路径会发生偏移.
  7. [置顶] Android ViewPager+Fragment超高仿微信主界面(带底部图标

随机推荐

  1. android打电话、发短信实现
  2. Vibrator
  3. Android在线资源API
  4. Android Activity设置无标题和全屏
  5. Android HAL 研究开发 FOR LED
  6. Android 热更新ICON图标
  7. android之通过URL来获取网络资源并下载资
  8. React-Native搭建报错:Unable to load scr
  9. Android(安卓)Gradle 多渠道打包
  10. ConstraintLayout + CardView + Space +