空间置顶:永远保留在最顶层,类似于天天动听的桌面歌词那样,始终在最顶层。

       API中有这样一个常量:WindowManager.LayoutParams.TYPE_SYSTEM_ALERT。 
文档中对它的的描述为:“Window type: system window, such as low power alert. These windows are always on top of application windows.”也就是说用这个type可以显示在其他application的顶层,但注意:当用到这个常量的时候,要加上相应的权限,即: 
<uses-permission android:name="android.permission.SYSTEM_ALERT_WINDOW" />。 
这个权限在文档中的描述为:“Allows an application to open windows using the type TYPE_SYSTEM_ALERT, shown on top of all other applications. Very few applications should use this permission; these windows are intended for system-level interaction with the user.” 
WindowManager mWin = (WindowManager)getSystemService(Context.WINDOW_SERVICE) 
然后使用addView的方法创建窗体,这样的窗体时凌驾于任何程序之上的
  • 0
    点赞
  • 0
    收藏
    觉得还不错? 一键收藏
  • 0
    评论
评论
添加红包

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

当前余额3.43前往充值 >
需支付:10.00
成就一亿技术人!
领取后你会自动成为博主和红包主的粉丝 规则
hope_wisdom
发出的红包
实付
使用余额支付
点击重新获取
扫码支付
钱包余额 0

抵扣说明:

1.余额是钱包充值的虚拟货币,按照1:1的比例进行支付金额的抵扣。
2.余额无法直接购买下载,可以购买VIP、付费专栏及课程。

余额充值