我想知道安卓系统动画(Activity A 切换到 Activity B 的动画)持续多长时间,以及如何测量这个时间。我应该使用一些工具还是在代码中使用日志记录?
我想知道安卓系统动画(Activity A 切换到 Activity B 的动画)持续多长时间,以及如何测量这个时间。我应该使用一些工具还是在代码中使用日志记录?
@android:integer/config_activityShortDur
@android:integer/config_activityDefaultDur
android.R.integer.config_activityShortDur
android.R.integer.config_activityDefaultDur
来自消息来源:
<!-- The duration (in milliseconds) of a short animation. -->
<integer name="config_shortAnimTime">200</integer>
<!-- The duration (in milliseconds) of a medium-length animation. -->
<integer name="config_mediumAnimTime">400</integer>
<!-- The duration (in milliseconds) of a long animation. -->
<integer name="config_longAnimTime">500</integer>
<!-- The duration (in milliseconds) of the activity open/close and fragment open/close animations. -->
<integer name="config_activityShortDur">150</integer>
<integer name="config_activityDefaultDur">220</integer>
android:duration="yourtime"
fade_in.xml
<?xml version="1.0" encoding="utf-8"?>
<alpha xmlns:android="http://schemas.android.com/apk/res/android"
android:interpolator="@android:anim/accelerate_interpolator"
android:fromAlpha="0.0" android:toAlpha="1.0"
android:duration="200" />
fade_out.xml
<?xml version="1.0" encoding="utf-8"?>
<alpha xmlns:android="http://schemas.android.com/apk/res/android"
android:interpolator="@android:anim/accelerate_interpolator"
android:fromAlpha="1.0" android:toAlpha="0.0"
android:fillAfter="true"
android:duration="200" />
Intent i = new Intent(this, NewActivity.class);
startActivity(i);
overridePendingTransition(R.anim.fade_in, R.anim.fade_out);