简体   繁体   English

如何在Android中以编程方式启用“显示触摸”选项?

[英]How to programmatically enable “show touches” option in Android?

I want to enable "show touches" in Settings of Android device. 我想在Android设备的设置中启用“显示触摸”。 Here is the link, which show us the way to access "touch settings", but I didn't find there the way to access "show touches". 这里是链接,向我们展示了访问“触摸设置”的方法,但是我没有找到访问“显示触摸”的方法。 How to programmatically check, get and set touch settings in android phones? 如何在Android手机中以编程方式检查,获取和设置触摸设置?

Help me, please! 请帮帮我!

Here is the solution I found: 这是我找到的解决方案:

To enable show touches : 要启用显示触摸

Settings.System.putInt(context.getContentResolver(),
                "show_touches", 1);

To disable show touches : 禁用显示触摸

Settings.System.putInt(context.getContentResolver(),
                "show_touches", 0);

Remember to add android.permission.WRITE_SETTINGS to your Manifest . 请记住将android.permission.WRITE_SETTINGS添加到Manifest

if still not works Use solution Given By Top And Change Target Version to 22 in Manifest File. 如果仍然无法使用,请使用顶部给出的解决方案,并将清单文件中的目标版本更改为22。 it will work fine Thanks for Answer TOP. 它将正常工作,谢谢您的答复。

声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM