activity跳转,关闭页面动画以及对跳转黑屏处理

跳转的时候在跳转之后加overridePendingTransition(R.anim.push_bottom_in,R.anim.push_style_out);

yixiao.setOnClickListener(new View.OnClickListener() {
          @Override
          public void onClick(View view) {
              Intent intenta = new Intent(MainActivity.this, TabYxiaoActivity.class);
              startActivity(intenta);
              overridePendingTransition(R.anim.push_bottom_in,R.anim.push_style_out);
          }
      });

关闭页面在finish之后加 overridePendingTransition(0,R.anim.push_bottom_out);

 back.setOnClickListener(new View.OnClickListener() {
            @Override
            public void onClick(View view) {
                finish();
                overridePendingTransition(0,R.anim.push_bottom_out);
            }
        });	      

上下滑动动画:push_bottom_in

<translate
    android:duration="500"
    android:fromYDelta="100%p"
    android:toYDelta="0"
 />      

上下滑动动画:push_bottom_out

<set xmlns:android="http://schemas.android.com/apk/res/android" >
    <translate
        android:duration="500"
        android:fromYDelta="0"
        android:toYDelta="100%p" />
</set> 

防止黑屏:push_style_out

<set  xmlns:android="http://schemas.android.com/apk/res/android">
    <alpha
        android:fromAlpha="1"
        android:toAlpha="1"
        android:duration="500"
        />
</set>

猜你喜欢

转载自blog.csdn.net/jiaosheng1/article/details/91959826