IT袋

当前位置:主页 > 经验教程 > 手机教程 >

安卓11怎么解除文件访问限制

安卓11怎么解除文件访问限制 小米安卓11解除data权限(6)

时间:2023-09-14 12:10:41 来源:IT袋 作者:苏晓敏
导读:安卓11怎么解除文件访问限制,在 Android 11 中使用 NDK Thermal API 监控设备上的温度变化,然后采取相应措施以降低耗电量和设备温度。该 API 类似于Java Thermal API;您可以使用它接收任何热

安卓11怎么解除文件访问限制

在 Android 11 中使用 NDK Thermal API 监控设备上的温度变化,然后采取相应措施以降低耗电量和设备温度。该 API 类似于Java Thermal API;您可以使用它接收任何热状态更改的通知或直接轮询当前状态。

文本和输入

改进了 IME 转换

Android 11 引入了新的 API 以改进输入法 (IME) 的转换,例如屏幕键盘。这些 API 可让您更轻松地调整应用内容,与 IME 的出现和消失以及状态和导航栏等其他元素保持同步。

如需在聚焦至任何 EditText 时显示 IME,请调用 view.getInsetsController().show(Type.ime())(您可以在与聚焦的 EditText 相同层次结构中的任何视图上调用此方法,无需专门在 EditText 上调用它)。如需隐藏 IME,请调用 view.getInsetsController().hide(Type.ime())。您可以通过调用 view.getRootWindowInsets().isVisible(Type.ime()) 检查 IME 当前是否可见。

如需同步应用的视图与 IME 的显示和消失,请通过提供
WindowInsetsAnimation.Callback 到 View.setWindowInsetsAnimationCallback() 在视图上设置监听器(您可以在任何视图上设置该监听器,它不一定必须为 EditText)。IME 会调用监听器的 onPrepare() 方法,之后会在转换开始时调用 onStart()。然后,它会在每次转换的过程中调用 onProgress()。转换完成后,IME 会调用 onEnd()。在转换过程中,您随时可以调用 WindowInsetsAnimation.getFraction() 以了解转换的进度。

控制 IME 动画

您还可以控制 IME 动画或其他系统栏(如导航栏)的动画。如需执行此操作,请先调用
setOnApplyWindowInsetsListener(),为窗口边衬区更改设置新的监听器:

KOTLIN

<pre spellcheck="false" lang="java" cid="n588" mdtype="fences">rootView.setOnApplyWindowInsetsListener { rootView, windowInsets -> val barsIme = windowInsets.getInsets(Type.systemBars() or Type.ime()) rootView.setPadding(barsIme.left, barsIme.top, barsIme.right, barsIme.bottom) // We return the new WindowInsets.CONSUMED to stop the insets being // dispatched any further into the view hierarchy. This replaces the // deprecated WindowInsets.consumeSystemWindowInsets() and related // functions. WindowInsets.CONSUMED}</pre>

JAVA

<pre spellcheck="false" lang="java" cid="n590" mdtype="fences">mRoot.setOnApplyWindowInsetsListener(new View.OnApplyWindowInsetsListener() { @Override public WindowInsets onApplyWindowInsets(View v, WindowInsets insets) { Insets barsIME = insets.getInsets(Type.systemBars() | Type.ime()); mRootView.setPadding(barsIme.left, barsIme.top, barsIme.right, barsIme.bottom); // We return the new WindowInsets.CONSUMED to stop the insets being // dispatched any further into the view hierarchy. This replaces the // deprecated WindowInsets.consumeSystemWindowInsets() and related // functions. return WindowInsets.CONSUMED; }});</pre>

相关阅读