安卓11怎么解除文件访问限制 小米安卓11解除data权限(6)
安卓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>
相关阅读
-
华为nova9电池百分比怎么设置 华为nova9pro怎么设置电池百分比
小编为大家说一说华为nova9pro怎么设置电池百分比方面的介绍,华为nova9pro设置电池百分比需三个步骤,在电量百分比显示方式设置中选择电池图标外或电池图标内即可,具体操作步骤如下:
-
iqoo8双击亮屏在哪设置 vivoiqoo双击亮屏怎么设置
你是不是想知道iqoo8双击亮屏在哪设置的内容,iqoo8设置双击亮屏只需在快捷与辅助功能中进入智能体感,然后在智能亮屏熄屏中打开双击亮屏。具体操作步骤如下:
-
苹果手机14无线充电 苹果14plus无线充电多少w
一篇IT技术小知识,为您介绍苹果14plus无线充电多少w的相关话题,苹果14plus可以支持最高15W的MagSafe 无线充电和最高7.5W的Qi无线充电,同时还支持20W有线充电。
-
荣耀X40 GT支持nfc功能吗 有nfc功能吗
今日重点为您介绍荣耀X40 GT支持nfc功能吗的相关话题,荣耀X40 GT支持nfc功能,支持nfc读写卡功能和NFC模拟卡功能,使用手机即可充当公交卡和门禁卡。


