如何启用"过渡动画缩放"在"开发方式];编程? [英] How to enable "Transition Animation Scale" in "Developer Options" programmatically ?

查看:201
本文介绍了如何启用"过渡动画缩放"在"开发方式];编程?的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我有我的一些活动的动画过渡。因此,一个活动开始时,一些褪色的动画大作。这里是code:

I have some animation transitions for my activities. So when an activity starts, it comes up with some fade animations. Here is the code:

Intent intent = new Intent(this, NextActivity.class);
startActivity(intent);
overridePendingTransition (android.R.anim.fade_in, android.R.anim.fade_out);

问题是,当过渡动画缩放中的开发人员选项功能关闭,这些动画将无法运行。所以我在寻找一种方法以编程方式启用此功能,以确保显示我的动画。
有没有办法将过渡动画缩放到动画缩放1x?

The Problem is that, these animations will not run when "Transition Animation Scale" in "Developer Options" is off. So I'm searching for a way to enable this feature programmatically to ensure that my animations shown. Is There a way to set "Transition Animation Scale" to "Animation scale 1x"?

推荐答案

过了几天寻找我已经找到了code,可以启用(或禁用)过渡动画缩放。

After a few days searching I have found the code which can enable (or disable) "Transition Animation Scale".

        Settings.Global.putInt(getContentResolver(), Global.TRANSITION_ANIMATION_SCALE, 1);

但是,与此code 一个大问题
如果你问什么问题?我会告诉这行code需求此权限:

But there is a big problem with this code And if you ask whats the problem? I would tell this line of code needs this permission:

< 使用许可权的android:NAME =android.permission.WRITE_SECURE_SETTINGS/>

其中的仅授予系统应用。所以,你的应用程序必须是系统的应用程序。

which is only granted to the system Apps. So your app must be a system app.

这个问题是关于制造系统的应用:如何使我的应用系统

This question is about making a system application : How to make my application system

更新

和@TripeHound说,我们

and as @TripeHound said, we can

显示一个对话框,告诉用户该应用程序看起来更漂亮
  如果他们打开这个选项(同时可以选择不显示信息
  如果他们又真的希望它关闭)

Display a dialog telling the user that the app will look much nicer if they turn this option on (with an option to not display the message again if they really want it off)

如何打开开发人员选项设置?

How to open developer options settings?

这方式:

startActivityForResult(new Intent(android.provider.Settings.ACTION_APPLICATION_DEVELOPMENT_SETTINGS), 0);

这篇关于如何启用"过渡动画缩放"在"开发方式];编程?的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
相关文章
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆