- html - 出于某种原因,IE8 对我的 Sass 文件中继承的 html5 CSS 不友好?
- JMeter 在响应断言中使用 span 标签的问题
- html - 在 :hover and :active? 上具有不同效果的 CSS 动画
- html - 相对于居中的 html 内容固定的 CSS 重复背景?
代码A来自CameraX项目,你可以看到source code .
当我删除 @SuppressLint("RestrictedApi")
时,Android Studio 将显示“只能从同一个库组中调用” ,您可以看到图 1。
为什么我不能删除 @SuppressLint("RestrictedApi")
在代码 A 中? deos 限制 API 是什么意思?
代码 A
@SuppressLint("RestrictedApi")
private fun updateCameraUi() {
...
// Listener for button used to switch cameras
controls.findViewById<ImageButton>(R.id.camera_switch_button).setOnClickListener {
lensFacing = if (CameraX.LensFacing.FRONT == lensFacing) {
CameraX.LensFacing.BACK
} else {
CameraX.LensFacing.FRONT
}
try {
// Only bind use cases if we can query a camera with this orientation
CameraX.getCameraWithLensFacing(lensFacing)
// Unbind all use cases and bind them again with the new lens facing configuration
CameraX.unbindAll()
bindCameraUseCases()
} catch (exc: Exception) {
// Do nothing
}
}
}
最佳答案
自本教程制作以来,库中发生了重大变化。
将软件包版本恢复为 1.0.0-alpha06
,和教程一样,解决了问题。
关于android - 为什么当我删除 @SuppressLint "only be called from with the same library group"时 Android Studio 会显示 ("RestrictedApi")?,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/58567716/
我在一些代码中遇到了 @SuppressLint("InlinedApi"),但在网上找不到任何关于它的描述。我理解 @SuppressLint("NewApi") 用于在我们编写高于 list 中提
谁能给我解释一下@SuppressWarnings 和@SuppressLint 之间的区别?我们什么时候应该使用一个而不是另一个? 我已经阅读了文档,但仍然不明白其中的区别。使用示例/示例代码进行解
我的应用程序中有关于 StrictMode 的问题,并添加了基本上禁用 StrictModeHelper 的代码 fragment 。但是,Lint 现在提示 setThreadPolicy() 并建
在某些情况下,我想在我的 ScrollView 上禁用滚动。 为此,我使用 .setOnTouchListener 并在 onTouch 中返回 true。 3.0 studio 给了我 lint 警
我试图理解以下代码中 @SuppressLint Java 注释的用途: @SuppressLint("StaticFieldLeak") private class RemoteDataTask e
我是一名安卓初学者。在尝试管理 Activity 生命周期的代码时,我遇到了一个新事物。 package com.example.activitylaunch; import android.os.B
我尝试使用以下代码连接“数字”(整数变量)和“$”(字符串),但我收到了来自 android studio 的警告:“不要连接使用 setText 显示的文本。将资源字符串与占位符一起使用。”并建议我
我现在想知道使用@SuppressLint("RestrictedApi") 注释是否安全。我很确定答案是否定的,所以我也想问问为什么。 我猜想开发团队想对 API 用户隐藏这样的受限代码。可能是由于
目前,我需要忽略与国际化相关的字符串连接警告,但希望将来“学习如何钓鱼” 以获取其他专门的警告。 最佳答案 使用android studio 1.5.1 bundle 的版本 lint --list
代码A来自CameraX项目,你可以看到source code . 当我删除 @SuppressLint("RestrictedApi") 时,Android Studio 将显示“只能从同一个库组中
我是 Android 的初学者,目前仍坚持以下问题:http://developer.android.com/training/basics/firstapp/starting-activity.ht
我是一名优秀的程序员,十分优秀!