使用淡入淡出动画自动传递两个活动

时间:2016-01-03 16:55:25

标签: java android android-animation

我有一个活动显示我的徽标,我希望在两秒后自动更改为第二个活动。

我已经这样做了,但它没有应用效果。

  

Logo.java

@Override
protected void onCreate(Bundle savedInstanceState)
{
    super.onCreate(savedInstanceState);
    setContentView(R.layout.logo_layout);

    new Handler().postDelayed(new Runnable()
    {
        @Override
        public void run()
        {
            Intent i = new Intent(Logo.this, Loggin.class);
            ActivityOptions options = ActivityOptions.makeSceneTransitionAnimation(Logo.this);
            startActivity(i, options.toBundle());
            finishAfterTransition();

        }
    }, TIME);
}
  

RES /过渡/ my_trasition.xml

     <?xml version="1.0" encoding="utf-8"?>
 <transitionSet xmlns:android="http://schemas.android.com/apk/res/android">
   <fade
        android:duration="1000">
   </fade>
</transitionSet>
  

RES /值/ styles.xml

<resources>

<!-- Base application theme. -->
<style name="AppFullScreen" parent="@style/Theme.AppCompat.Light.NoActionBar">
    <!-- Customize your theme here. -->
    <item name="windowNoTitle">true</item>
    <item name="windowActionBar">false</item>
    <item name="android:windowFullscreen">true</item>
    <item name="android:windowContentOverlay">@null</item>
    <item name="android:windowContentTransitions">true</item>
    <item name="android:windowEnterTransition">@transition/transicion</item>
    <item name="android:windowExitTransition">@transition/transicion</item>
    <item name="android:windowAllowEnterTransitionOverlap">false</item>
    <item name="android:windowAllowReturnTransitionOverlap">false</item>
</style>

0 个答案:

没有答案