我的应用程序要求父活动中的权限,而片段已显示给用户
当app请求权限时,后台变为完全白色我想在片段顶部显示权限对话框但不覆盖全屏
有什么想法吗?
在
下面添加代码int finePermission = ContextCompat.checkSelfPermission(this, Manifest.permission.ACCESS_FINE_LOCATION);
List<String> listPermissionsNeeded = new ArrayList<>();
if (finePermission != PackageManager.PERMISSION_GRANTED) {
listPermissionsNeeded.add(Manifest.permission.ACCESS_FINE_LOCATION);
listPermissionsNeeded.add(Manifest.permission.ACCESS_COARSE_LOCATION);
}
if (!listPermissionsNeeded.isEmpty()) {
ActivityCompat.requestPermissions(this, listPermissionsNeeded.toArray(new String[listPermissionsNeeded.size()]), PERMISSION_CODE);
}
答案 0 :(得分:-3)
将此行添加到对话框
dialog.getWindow().setBackgroundDrawable(new ColorDrawable(Color.TRANSPARENT));