Не знаю почему, но анимации для экрана spla sh вообще не работают. Я думаю, мои коды верны! .. Все, что я хочу, это выполнить анимацию содержимого экрана spla sh.
public class Welcome extends AppCompatActivity {
Animation topAnim, bottomAnim;
ImageView imageView;
TextView textView;
private static int SPLASH_TIME_OUT=4000;
@Override
protected void onCreate(Bundle savedInstanceState) {
super.onCreate(savedInstanceState);
getWindow().setContentView(R.layout.activity_welcome);
topAnim = AnimationUtils.loadAnimation(this,R.anim.top_animation);
bottomAnim = AnimationUtils.loadAnimation(this,R.anim.bottom_animation);
imageView = findViewById(R.id.imageView3);
textView = findViewById(R.id.textView);
imageView.startAnimation(topAnim);
textView.startAnimation(bottomAnim);
getWindow().setFlags(WindowManager.LayoutParams.FLAG_FULLSCREEN,WindowManager.LayoutParams.FLAG_FULLSCREEN);
setContentView(R.layout.activity_welcome);
new Handler().postDelayed(new Runnable() {
@Override
public void run() {
Intent homeIntent =new Intent(Welcome.this,MainActivity.class);
startActivity(homeIntent);
finish();
}
},SPLASH_TIME_OUT);
}
}
Это анимация снизу и сверху. xml файлы соответственно
<translate
android:fromXDelta="0%"
android:fromYDelta="100%"
android:duration="1500" />
<alpha
android:fromAlpha="0.1"
android:toAlpha="1.0"
android:duration="1500" />
<translate
android:fromXDelta="0%"
android:fromYDelta="-50%"
android:duration="2000" />
<alpha
android:fromAlpha="0.1"
android:toAlpha="1.0"
android:duration="1500" />