Android M - 自定义权限对话框样式

Android M - custom permission dialog style

在实施新的 Android M 权限模型时,我注意到权限对话框不符合我的 styles.xml.

的主题

在我的 styles.xml 中,我重写了这样的对话框和警报对话框样式:

<item name="android:dialogTheme">@style/Theme.dialog</item>
<item name="android:alertDialogTheme">@style/Theme.dialog</item>

是否可以更改主题?

还是因为这是设备设置中的系统对话框?

不,这不可能。权限对话框是 system dialog,因此您不能更改其主题:

The M Developer Preview introduces a new app permissions model which streamlines the process for users to install and upgrade apps. If an app running on the M Preview supports the new permissions model, the user does not have to grant any permissions when they install or upgrade the app. Instead, the app requests permissions as it needs them, and the system shows a dialog to the user asking for the permission.