new*_*v92 5 android accessibility
如何检测是否在辅助功能设置中启用了“高对比度”设置(适用于 Android 5.0+)?
在类中AccessibilityManager(请参阅此处的源代码),您有一个名为的公共方法isHighTextContrastEnabled,您可以使用它来获取信息:
/**
* Returns if the high text contrast in the system is enabled.
* <p>
* <strong>Note:</strong> You need to query this only if you application is
* doing its own rendering and does not rely on the platform rendering pipeline.
* </p>
*
* @return True if high text contrast is enabled, false otherwise.
*
* @hide
*/
public boolean isHighTextContrastEnabled() {
synchronized (mLock) {
IAccessibilityManager service = getServiceLocked();
if (service == null) {
return false;
}
return mIsHighTextContrastEnabled;
}
}
Run Code Online (Sandbox Code Playgroud)
因此,在您的代码中,您可以通过这样做来访问此方法(如果您位于Activity):
AccessibilityManager am = (AccessibilityManager) this.getSystemService(Context.ACCESSIBILITY_SERVICE);
boolean isHighTextContrastEnabled = am.isHighTextContrastEnabled();
Run Code Online (Sandbox Code Playgroud)
| 归档时间: |
|
| 查看次数: |
2319 次 |
| 最近记录: |