如何自定义权限对话框中的Andr​​oid? [英] How can i customize permission dialog in android?

查看:706
本文介绍了如何自定义权限对话框中的Andr​​oid?的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

假设我在像以下运行时请求权限:

Suppose I request a permission at runtime like the following:

ActivityCompat.requestPermissions(thisActivity,
            new String[]{Manifest.permission.READ_CONTACTS},
            MY_PERMISSIONS_REQUEST_READ_CONTACTS);

Android系统创建了一个弹出式对话框请求权限。我怎么能定义一个自定义布局的对话框?

Android system creates a popup dialog to request permission. How can i define a custom layout for that dialog?

推荐答案

简短的回答是,您不能

由于Android文档所说:

As android documentation puts:

当您的应用程序调用requestPermissions(),系统显示一个标准对话框给用户。您的应用程序的不能配置或改变该对话框。如果您需要提供任何资料或解释给用户,你应该做的,你叫requestPermissions()之前,如解释为什么应用程序需要的权限。

When your app calls requestPermissions(), the system shows a standard dialog box to the user. Your app cannot configure or alter that dialog box. If you need to provide any information or explanation to the user, you should do that before you call requestPermissions(), as described in "Explain why the app needs permissions".

所以,没有办法来定义权限对话框自定义布局现在

So, there is no way to define a custom layout for the permission dialog for now.

这篇关于如何自定义权限对话框中的Andr​​oid?的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆