美团外卖招聘送餐骑手送餐员底薪3000比需送700单才蒙拿到底薪,是坑人吗?求做过的美团外卖招聘送餐骑手骑手回答

【07-08讨论】安卓6.0如何开启悬浮窗权限【android吧】_百度贴吧
&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&签到排名:今日本吧第个签到,本吧因你更精彩,明天继续来努力!
本吧签到人数:0成为超级会员,使用一键签到本月漏签0次!成为超级会员,赠送8张补签卡连续签到:天&&累计签到:天超级会员单次开通12个月以上,赠送连续签到卡3张
关注:1,187,162贴子:
【07-08讨论】安卓6.0如何开启悬浮窗权限收藏
本人喜欢录制一些游戏视频,最近发现了AZ录制。以前用5.0flyme手机中心自带权限。后来换个MI4并刷入安卓6.0.然后当我再想录制时,提示我开启悬浮窗权限。我想了想,去设置里翻了下,没有。下了个360,嘿,有,但是并没有什么用...
后来,我翻了下百度,原来安卓6.0取消了悬浮窗。
那么..我想问一下,怎么开启悬浮窗。
WindowsMager我承受不起。最好方法简单。除了刷别的系统外。如果教我刷IOS,我可以考虑下
【OPPO R11】立即购买,前后2000万,拍照更清晰
设置,自己找
cm自带录制
   --来自一只还没有断触的LG G2
设置-应用-右上角齿轮,然后楼上
登录百度帐号推荐应用你的位置: &
> OPPO R9s怎么设置悬浮窗权限方法
OPPO R9s怎么设置悬浮窗权限方法
更新时间:
收藏本页(Ctrl+D)
手机扫描查看
扫描二维码
  OPPO R9s怎么设置悬浮窗权限方法相信很多用户还不太清楚,下面统一小编来跟大家分享一下OPPO R9s怎么设置悬浮窗权限方法,感兴趣的一起来看下吧。
  OPPO R9s怎么设置悬浮窗权限方法
  1)在手机自带应用里面找到【手机管家】打开,进入手机管家以后点击【权限隐私】选项,接着选择【悬浮窗管理】。
  2)这时只需要把需要开启的应用对应的开关打开就可以了,往右边拨即开启。
【上一篇】
【下一篇】
看完这篇文章有何感觉?
(您的评论需要经过审核才能显示,请文明发言!)&&剩余字数:
点击图片更换
统一文章资讯频道声明
1、 所有来源标注为统一下载站或统一文章的内容版权均为本站所有,若您需要引用、转载,请注明来源及原文链接即可,如涉及大面积转载,请来信告知,获取授权。
2、 本站所提供的文章资讯等内容均为作者提供、网友推荐、互联网整理而来,仅供学习参考,如有侵犯您的版权,请及时联系我们,并提供原文出处等,本站将在三个工作日内修正。
3、 若您的网站或机构从本站获取的一切资源进行商业使用,除来源为本站的资料需与本站协商外,其他资源请自行联系版权所有人。
4、 未经统一下载站允许,不得盗链、盗用本站资源;不得复制或仿造本网站,不得在非统一下载站所属的服务器上建立镜像,统一下载站对其自行开发的或和他人共同开发的所有内容、技术手段和服务拥有全部知识产权,任何人不得侵害或破坏,也不得擅自使用。
文章教程分类
本站资源均收集整理于互联网,其著作权归原作者所有,如果有侵犯您权利的资源,请来信告知,我们将及时撤销相应资源。
Copy . All Rights Reserved.1278人阅读
android(5)
Android的窗口体系中,WindowManager占有非常重要的地位,平时我们使用悬浮窗会遇到一些权限的问题。
当&Android工程在
targetSdkVersion 23
编译,Android6.0及其以上版本手机使用悬浮窗功能时候,会发生
java.lang.RuntimeException: Unable to create service com.fb.tangyc.fbtools.service.FBService: android.view.WindowManager$BadTokenException: Unable to
add window android.view.ViewRootImpl$W@123e0ab -- permission denied for this window type
的异常,导致程序崩溃。
当Android工程在
targetSdkVersion 22
编译,Android6.0及其以上版本手机使用悬浮窗功能会正常使用
其实原因很简单,大部分的Android6.0手机(尤其是三星,谷歌原生手机)
在大于等于23版本下编译,悬浮窗权限默认是关闭没有权限,然在小于23版本下编译悬浮窗权限是开启有权限的。
所以在大于23版本下编译时需要去检测悬浮窗权限,并且获取悬浮窗权限,下面我就罗列下怎么去检测悬浮窗权限并且获取悬浮窗权限
if(Build.VERSION.SDK_INT&=23){
if(Settings.canDrawOverlays(this))
//有悬浮窗权限开启服务绑定 绑定权限 & & & & & Intent intent = new Intent(MainActivity.this, FBService.class); & & & & & startService(intent); & & & }else{
//没有悬浮窗权限m,去开启悬浮窗权限 & & & & & try{
intent=new Intent(Settings.ACTION_MANAGE_OVERLAY_PERMISSION); & & & & & & startActivityForResult(intent, OVERLAY_PERMISSION_REQ_CODE); & & & & & }catch (Exception e)
e.printStackTrace(); & & & & & }
//默认有悬浮窗权限 &但是 华为, 小米,oppo等手机会有自己的一套Android6.0以下 &会有自己的一套悬浮窗权限管理 也需要做适配 & &Intent intent = new Intent(MainActivity.this, FBService.class); & &startService(intent);}
每次使用悬浮窗的时候都要去检测权限,因为悬浮窗权限是可以手动关闭的。
位置位于 &(三星S6为例Android6.0.1版本)设置-- 应用程序--应用程序管理器 -- 更多 --可出现在顶部的应用程序 --- 选择你的APP -- 运行在其他应用的上层显示&
下图所示:
当你点击悬浮窗权限app开关时候 退出 会在activity 有回调方法。
protected void onActivityResult(int requestCode, int resultCode, Intent data) { & &if (requestCode == OVERLAY_PERMISSION_REQ_CODE) { & & & &if(Build.VERSION.SDK_INT&=23) { & & & & & &if (!Settings.canDrawOverlays(this)) { & & & & & & & &Toast.makeText(this, &权限授予失败,无法开启悬浮窗&, Toast.LENGTH_SHORT).show(); & & & & & &} else { & & & & & & & & & & & Toast.makeText(this, &权限授予成功!&, Toast.LENGTH_SHORT).show(); & & & & & & &&//有悬浮窗权限开启服务绑定 绑定权限 & & & & & & & &Intent intent = new Intent(MainActivity.this, FBService.class); & & & & & & & &startService(intent); & & & & & &} & & & &} & &}}
下面就罗列下Service中启动悬浮的实现
首先 你需要在配置文件悬浮窗权限
&uses-permission android:name=&android.permission.SYSTEM_ALERT_WINDOW& /&
第二需要在服务中开启悬浮窗
public class FBService extends Service
private WindowManager wManager;// 窗口管理者 & &private WindowManager.LayoutParams mParams;// 窗口的属性 & &private FloatButtonLayout windowView; & &private SurfaceHolder holder; & &public static final String ACTION_ALPHA = &com.fb.alpha&; & &private ServiceReceiver receiver; & &@Override & &public void onCreate() {
super.onCreate(); & & & &wManager = (WindowManager) getSystemService(Context.WINDOW_SERVICE); & & & &mParams = new WindowManager.LayoutParams(WindowManager.LayoutParams.TYPE_SYSTEM_ERROR, WindowManager.LayoutParams.FLAG_NOT_FOCUSABLE, PixelFormat.TRANSPARENT); & & & &mParams.type = WindowManager.LayoutParams.TYPE_SYSTEM_ERROR;// 系统提示window & & & &mParams.format = PixelFormat.TRANSLUCENT;// 支持透明 & & & &// mParams.format = PixelFormat.RGBA_8888; & & & &mParams.flags |= WindowManager.LayoutParams.FLAG_NOT_TOUCH_MODAL | WindowManager.LayoutParams.FLAG_NOT_FOCUSABLE;// 焦点 & & & &mParams.width = WindowManager.LayoutParams.WRAP_CONTENT;// 窗口的宽和高 & & & &mParams.height = WindowManager.LayoutParams.WRAP_CONTENT; & & & &mParams.gravity = Gravity.LEFT | Gravity.TOP; & & & &mParams.y = SharedPreferencesUtils.getSharedPreferencesUtils().getParamsY(getApplicationContext()); & & & &mParams.x = SharedPreferencesUtils.getSharedPreferencesUtils().getParamsX(getApplicationContext()); & & & &mParams.windowAnimations = android.R.style.Animation_Toast; & & & &// mParams.alpha = 0.8f;//窗口的透明度 & & & &LayoutInflater layoutInflater = LayoutInflater.from(getApplicationContext()); & & & &windowView = (FloatButtonLayout) layoutInflater.inflate(R.layout.float_button_layout, null); & & & &wManager.addView(windowView, mParams);// 添加窗口 & & & & &}
第三,关闭服务时候,关闭悬浮窗
@Overridepublic void onDestroy() {
if (wManager!=null&&windowView != null) {
wManager.removeView(windowView); & &}
super.onDestroy();}
这就是在Android下面开启悬浮窗权限的全部流程。
Android订阅是探讨Android开发的公众号,分享最有价值的Android干货文章
欢迎关注我们,一起讨论技术,扫描和长按下方的二维码可快速关注我们
点赞关注转发是对我们最大的支持
&&相关文章推荐
* 以上用户言论只代表其个人观点,不代表CSDN网站的观点或立场
访问:5485次
排名:千里之外android悬浮窗口显示在任何activities上的实现原理
最近一些软件有了很牛X的悬浮窗口功能,很好奇怎么实现的,刚刚终于弄出来了...原理就是调用WindowManager直接操控View,然后再配合
相应的WindowManager.LayoutParams属性,就OK了。这样产生出来的View根据LayoutParams的属性不同,效果也不
一样。有关具体的属性,请自行参考SDK文档。
以下代码请仅供演示:
public class myFloatView extends Activity {
& & @Override
& & public void
onCreate(Bundle savedInstanceState) {
&&&super.onCreate(savedInstanceState);
&&&setContentView(R.layout.main);
&&&Button bb=new
Button(getApplicationContext());
&&&WindowManager
wm=(WindowManager)getApplicationContext().getSystemService("window");
&&&WindowManager.LayoutParams
wmParams = new WindowManager.LayoutParams();
&&&wmParams.type=2002;&&//type是关键,这里的2002表示系统级窗口,你也可以试试2003。
&&&wmParams.format=1;
&&&wmParams.flags=40;
&&&wmParams.width=40;
&&&wmParams.height=40;
&&&wm.addView(bb,
wmParams);&
PS:本代码在Android2.3下测试无错(从API
Level来看,实际上android1.5都可行)!另外别忘了在AndroidManifest.xml文件中加入如下权限:
=============================
已经给出可自由移动悬浮窗口的Demo,请移步至这里:
转载:/thread-.html
已投稿到:
以上网友发言只代表其个人观点,不代表新浪网的观点或立场。9878人阅读
android(7)
突破小米悬浮窗权限控制–不需要权限的悬浮窗
在上一篇文章讲了Android的Toast拓展,在原生Toast基础上对显示时长和显示动画做了二次封装,强化了Toast的部分功能。也分析了对于二次封装的ExToast设计原理,以及Toast的关键点。如果不了解的可以看看下面的链接。
常用悬浮窗与Toast
之前分析过,Toast其实就是系统悬浮窗的一种,那它跟常用的系统悬浮窗有什么区别呢?
先看一下常用的Andoird系统悬浮窗写法:
mContext = context.getApplicationContext();
mWindowManager = (WindowManager) mContext.getSystemService(Context.WINDOW_SERVICE);
mView = setUpView(context);
final WindowManager.LayoutParams params = new WindowManager.LayoutParams();
params.type = WindowManager.LayoutParams.TYPE_SYSTEM_ALERT;
int flags = WindowManager.LayoutParams.FLAG_ALT_FOCUSABLE_IM;
params.flags =
params.format = PixelFormat.TRANSLUCENT;
params.width = LayoutParams.MATCH_PARENT;
params.height = LayoutParams.MATCH_PARENT;
params.gravity = Gravity.CENTER;
mWindowManager.addView(mView, params);
再看看在Toast源码里面的写法关键代码:
final WindowManager.LayoutParams params = mP
params.height = WindowManager.LayoutParams.WRAP_CONTENT;
params.width = WindowManager.LayoutParams.WRAP_CONTENT;
params.format = PixelFormat.TRANSLUCENT;
params.windowAnimations = com.android.internal.R.style.Animation_T
params.type = WindowManager.LayoutParams.TYPE_TOAST;
params.setTitle("Toast");
params.flags = WindowManager.LayoutParams.FLAG_KEEP_SCREEN_ON
| WindowManager.LayoutParams.FLAG_NOT_FOCUSABLE
| WindowManager.LayoutParams.FLAG_NOT_TOUCHABLE;
Context context = mView.getContext().getApplicationContext();
mWM = (WindowManager)context.getSystemService(Context.WINDOW_SERVICE);
if (mView.getParent() != null) {
mWM.removeView(mView);
mWM.addView(mView, mParams);
上面的两段代码大致流程都是一样的:创建WindowManager.LayoutParams做窗口的配置-&通过context获取WindowManager服务-&通过WindowManager服务添加悬浮窗View
主要的不同点在于WindowManager.LayoutParams的type。
WindowManager.LayoutParams的type有很多种,包括各种系统对话框,锁屏窗口,电话窗口等等,但这些窗口基本上都是需要权限的。
而我们平时使用的Toast,并不需要权限就能显示,那就可以尝试直接把悬浮窗的类型设成TYPE_TOAST,来定制一个不需要权限的悬浮窗。
下面是demo代码:
import android.content.C
import android.graphics.PixelF
import android.util.L
import android.view.G
import android.view.LayoutI
import android.view.MotionE
import android.view.V
import android.view.WindowM
import android.widget.TextV
public class ADToast implements View.OnTouchListener {
Context mC
WindowManager.LayoutP
WindowManager mWM;
private float mTouchStartX;
private float mTouchStartY;
private float
private float
public ADToast(Context context){
this.mContext =
params = new WindowManager.LayoutParams();
params.height = WindowManager.LayoutParams.WRAP_CONTENT;
params.width = WindowManager.LayoutParams.WRAP_CONTENT;
params.format = PixelFormat.TRANSLUCENT;
params.windowAnimations = R.style.anim_
params.type = WindowManager.LayoutParams.TYPE_TOAST;
params.gravity = Gravity.LEFT | Gravity.TOP;
params.setTitle("Toast");
params.flags = WindowManager.LayoutParams.FLAG_NOT_TOUCH_MODAL
| WindowManager.LayoutParams.FLAG_NOT_FOCUSABLE;
mWM = (WindowManager)context.getSystemService(Context.WINDOW_SERVICE);
LayoutInflater inflate = (LayoutInflater)
mContext.getSystemService(Context.LAYOUT_INFLATER_SERVICE);
mView = inflate.inflate(R.layout.float_tips_layout, null);
mView.setOnTouchListener(this);
public void show(){
TextView tv = (TextView)mView.findViewById(R.id.message);
tv.setText("悬浮窗");
if (mView.getParent() != null) {
mWM.removeView(mView);
mWM.addView(mView, params);
public void hide(){
if(mView!=null){
mWM.removeView(mView);
public void setText(String text){
TextView tv = (TextView)mView.findViewById(R.id.message);
tv.setText(text);
private void updateViewPosition(){
params.x=(int) (x-mTouchStartX);
params.y=(int) (y-mTouchStartY);
mWM.updateViewLayout(mView, params);
public boolean onTouch(View v, MotionEvent event) {
x = event.getRawX();
y = event.getRawY();
Log.i("currP", "currX"+x+"====currY"+y);
switch (event.getAction()) {
case MotionEvent.ACTION_DOWN:
mTouchStartX =
event.getX();
mTouchStartY =
event.getY();
Log.i("startP","startX"+mTouchStartX+"====startY"+mTouchStartY);
case MotionEvent.ACTION_MOVE:
updateViewPosition();
case MotionEvent.ACTION_UP:
updateViewPosition();
return true;
float_tips_layout.xml
&?xml version="1.0" encoding="utf-8"?&
xmlns:android="/apk/res/android"
android:layout_width="match_parent"
android:layout_height="match_parent"
android:gravity="center"
android:orientation="vertical"
android:background="@android:color/black"&
android:id="@+id/message"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:layout_gravity="center_horizontal"
android:layout_marginStart="32dp"
android:layout_marginEnd="32dp"
android:lineSpacingExtra="16dp"
android:maxLines="2"
android:textColor="@android:color/white"
android:shadowColor="#bbffffff"
android:shadowRadius="2.75"
android:textSize="40sp"
然而,这种使用方式,在小米最新的MIUI8系统上行不通!
使用N5原生6.0系统测试通过,使用一加3测试通过,使用魅族pro5测试通过。只有小米MIUI8,对Toast类型悬浮窗做了权限控制。
实测在MIUI8中,打开悬浮窗权限可以显示这种Toast类型的悬浮窗。而使用原生Toast类,却不需要权限就可以显示,看来小米的系统在framework层对Toast类型的权限做了特殊处理。
但是,只要Toast能显示,就说明肯定有方法绕过去。最好的方法,就是把小米改动的framework层代码扒出来,看看原生Toast和自定义Toast类型悬浮窗在权限处理上的区别是什么,但是有一定的难度,在研究了一天无果后,先使用了第二种更容易实现的方法。
既然原生Toast不需要权限,那我们就在原生Toast的基础上继续封装拓展。上一篇Toast拓展文章已经对Toast的二次封装解释的比较详细了,下面直接上Demo代码。
import android.content.C
import android.content.res.R
import android.os.H
import android.util.L
import android.view.G
import android.view.LayoutI
import android.view.MotionE
import android.view.V
import android.view.WindowM
import android.widget.TextV
import android.widget.T
import java.lang.reflect.F
import java.lang.reflect.InvocationTargetE
import java.lang.reflect.M
public class MiExToast implements View.OnTouchListener {
private static final String TAG = "ExToast";
public static final int LENGTH_ALWAYS = 0;
public static final int LENGTH_SHORT = 2;
public static final int LENGTH_LONG = 4;
private Context mC
private int mDuration = LENGTH_SHORT;
private int animations = -1;
private boolean isShow = false;
private Object mTN;
private WindowManager mWM;
private WindowManager.LayoutP
private View mV
private float mTouchStartX;
private float mTouchStartY;
private float
private float
private Handler handler = new Handler();
public MiExToast(Context context){
this.mContext =
if (toast == null) {
toast = new Toast(mContext);
LayoutInflater inflate = (LayoutInflater)
mContext.getSystemService(Context.LAYOUT_INFLATER_SERVICE);
mView = inflate.inflate(R.layout.float_tips_layout, null);
mView.setOnTouchListener(this);
private Runnable hideRunnable = new Runnable() {
public void run() {
* Show the view for the specified duration.
public void show(){
if (isShow) return;
TextView tv = (TextView)mView.findViewById(R.id.message);
tv.setText("悬浮窗");
toast.setView(mView);
show.invoke(mTN);
} catch (InvocationTargetException | IllegalAccessException e) {
e.printStackTrace();
isShow = true;
if (mDuration & LENGTH_ALWAYS) {
handler.postDelayed(hideRunnable, mDuration * 1000);
* Close the view if it's showing, or don't show it if it isn't showing yet.
* You do not normally have to call this.
Normally view will disappear on its own
* after the appropriate duration.
public void hide(){
if(!isShow) return;
hide.invoke(mTN);
} catch (InvocationTargetException | IllegalAccessException e) {
e.printStackTrace();
isShow = false;
public void setView(View view) {
toast.setView(view);
public View getView() {
return toast.getView();
* Set how long to show the view for.
* #LENGTH_SHORT
* #LENGTH_LONG
* #LENGTH_ALWAYS
public void setDuration(int duration) {
mDuration =
public int getDuration() {
public void setMargin(float horizontalMargin, float verticalMargin) {
toast.setMargin(horizontalMargin,verticalMargin);
public float getHorizontalMargin() {
return toast.getHorizontalMargin();
public float getVerticalMargin() {
return toast.getVerticalMargin();
public void setGravity(int gravity, int xOffset, int yOffset) {
toast.setGravity(gravity,xOffset,yOffset);
public int getGravity() {
return toast.getGravity();
public int getXOffset() {
return toast.getXOffset();
public int getYOffset() {
return toast.getYOffset();
public static MiExToast makeText(Context context, CharSequence text, int duration) {
Toast toast = Toast.makeText(context,text,Toast.LENGTH_SHORT);
MiExToast exToast = new MiExToast(context);
exToast.toast =
exToast.mDuration =
return exT
public static MiExToast makeText(Context context, int resId, int duration)
throws Resources.NotFoundException {
return makeText(context, context.getResources().getText(resId), duration);
public void setText(int resId) {
setText(mContext.getText(resId));
public void setText(CharSequence s) {
toast.setText(s);
public int getAnimations() {
public void setAnimations(int animations) {
this.animations =
private void initTN() {
Field tnField = toast.getClass().getDeclaredField("mTN");
tnField.setAccessible(true);
mTN = tnField.get(toast);
show = mTN.getClass().getMethod("show");
hide = mTN.getClass().getMethod("hide");
Field tnParamsField = mTN.getClass().getDeclaredField("mParams");
tnParamsField.setAccessible(true);
params = (WindowManager.LayoutParams) tnParamsField.get(mTN);
params.flags = WindowManager.LayoutParams.FLAG_NOT_TOUCH_MODAL
| WindowManager.LayoutParams.FLAG_NOT_FOCUSABLE;
/**设置动画*/
if (animations != -1) {
params.windowAnimations =
/**调用tn.show()之前一定要先设置mNextView*/
Field tnNextViewField = mTN.getClass().getDeclaredField("mNextView");
tnNextViewField.setAccessible(true);
tnNextViewField.set(mTN, toast.getView());
mWM = (WindowManager)mContext.getApplicationContext().getSystemService(Context.WINDOW_SERVICE);
} catch (Exception e) {
e.printStackTrace();
setGravity(Gravity.LEFT | Gravity.TOP,0 ,0);
private void updateViewPosition(){
params.x=(int) (x-mTouchStartX);
params.y=(int) (y-mTouchStartY);
mWM.updateViewLayout(toast.getView(), params);
public boolean onTouch(View v, MotionEvent event) {
x = event.getRawX();
y = event.getRawY();
Log.i("currP", "currX"+x+"====currY"+y);
switch (event.getAction()) {
case MotionEvent.ACTION_DOWN:
mTouchStartX =
event.getX();
mTouchStartY =
event.getY();
Log.i("startP","startX"+mTouchStartX+"====startY"+mTouchStartY);
case MotionEvent.ACTION_MOVE:
updateViewPosition();
case MotionEvent.ACTION_UP:
updateViewPosition();
return true;
MiExToast miToast = new MiExToast(getApplicationContext());
miToast.setDuration(MiExToast.LENGTH_ALWAYS);
miToast.setAnimations(R.style.anim_view);
miToast.show();
上面的Demo类是基于上一篇文章,进行再次拓展做出来的,它只是一个Demo,并不是工具类,不能直接拿来使用。
下面根据这个Demo,我们来分析它的原理。
下面有三个关键点:
1. Toast是可以自定义View的
2. 悬浮窗的触摸需要修改WindowManager.LayoutParams.flags,设置WindowManager.LayoutParams.FLAG_NOT_TOUCH_MODAL
3. 刷新悬浮窗,只需要获得WindowManager实例,调用updateViewLayout并传入View和LayoutParams即可
经过上一篇文章的讲解,对于Toast的LayoutParams实例我们可以通过反射获得,并且给他设置上可触摸的flag。关注上面代码的initTN()方法,获得的LayoutParams实例需要保持引用,因为后面还需要用上。
Field tnParamsField = mTN.getClass().getDeclaredField("mParams");
tnParamsField.setAccessible(true);
params = (WindowManager.LayoutParams) tnParamsField.get(mTN);
params.flags = WindowManager.LayoutParams.FLAG_NOT_TOUCH_MODAL
| WindowManager.LayoutParams.FLAG_NOT_FOCUSABLE;
然后是对二次封装的Demo类MiExToast里面的Toast实例设置View。这个应该很容易理解,Toast是可以自定义View的,设置自己的View作为悬浮窗。同时,可以对View添加一些自定义的Touch事件,在这个Demo中用户可以随意拖动悬浮窗。
public void init(){
mView = inflate.inflate(R.layout.float_tips_layout, null);
mView.setOnTouchListener(this);
toast.setView(mView);
public boolean onTouch(View v, MotionEvent event) {
x = event.getRawX();
y = event.getRawY();
return true;
最后就是对悬浮窗的更新,只需要通过context获取到WindowManager,即可调用updateViewLayout对悬浮窗进行更新。
private WindowManager.LayoutP
private void updateViewPosition(){
mWM.updateViewLayout(toast.getView(), params);
大致原理就是这样,借助原生Toast显示自定义的悬浮窗,越过小米MIUI8对于Toast类型悬浮窗的权限封锁。
最后上一个小米系统示例图:
转载请注明出处!
&&相关文章推荐
* 以上用户言论只代表其个人观点,不代表CSDN网站的观点或立场
访问:24099次
排名:千里之外
评论:40条
(2)(1)(2)(1)(3)(1)

我要回帖

更多关于 美团外卖怎么接单送餐 的文章

 

随机推荐