Android 悬浮窗口

   WindowManager wm = (WindowManager)getApplicationContext().getSystemService(Context.WINDOW_SERVICE);     
   WindowManager.LayoutParams params = new WindowManager.LayoutParams();     
   params.type = WindowManager.LayoutParams.TYPE_SYSTEM_OVERLAY;     
   params.flags = WindowManager.LayoutParams.FLAG_NOT_TOUCH_MODAL | WindowManager.LayoutParams.FLAG_NOT_FOCUSABLE;    
   
   params.width = WindowManager.LayoutParams.WRAP_CONTENT;     
   params.height = WindowManager.LayoutParams.WRAP_CONTENT;     
   params.format = PixelFormat.RGBA_8888;   
   TextView tv = new TextView(this);    
   tv.setText("这是悬浮的提示信息");   
   wm.addView(tv, params); 
<uses-permission android:name="android.permission.SYSTEM_ALERT_WINDOW"/>

 

上一篇:关于Android项目中的Toast那些动画实现方式


下一篇:Android GUI 系统总结之Window