我的启动画面出现问题。 我的启动画面非常简单,它只是两个动画。 我自己测试了它,索尼z3紧凑型和HTC m8都没问题。 但是我的一个朋友告诉我,我的闪屏动画在索尼ZR和HTC 816中变得迟钝,当我说长腿时,我的意思就像你在赛扬CPU上运行4k视频一样: 。 所有这款手机都使用Android 5或更高版本,如5.1。
SplashScreen.java:
packagetest.test.test;
import android.content.Intent;
import android.os.Bundle;
import android.os.Handler;
import android.support.v7.app.AppCompatActivity;
import android.view.View;
import android.view.WindowManager;
import android.view.animation.Animation;
import android.view.animation.AnimationSet;
import android.view.animation.AnimationUtils;
import android.view.animation.DecelerateInterpolator;
import android.widget.FrameLayout;
import android.widget.RelativeLayout;
import com.eftimoff.androidplayer.Player;
import com.eftimoff.androidplayer.actions.property.PropertyAction;
public class SplashScreen extends AppCompatActivity {
View logo;
RelativeLayout text;
@Override
protected void onCreate(Bundle savedInstanceState) {
super.onCreate(savedInstanceState);
getWindow().setFlags(WindowManager.LayoutParams.FLAG_FULLSCREEN, WindowManager.LayoutParams.FLAG_FULLSCREEN);
setContentView(R.layout.splesh_screen);
logo = findViewById(R.id.logo);
text = (RelativeLayout) findViewById(R.id.text);
animate(logo);
animate2(text);
new Handler().postDelayed(new Runnable() {
@Override
public void run() {
Intent i = new Intent(SplashScreen.this, MainActivity.class);
startActivity(i);
finish();
}
}, 4500);
}
public void animate(View animating_view) {
AnimationSet s = new AnimationSet(false);//false mean dont share interpolators
Animation anim_push_down, anim_fade_in, anim_push_up;
anim_push_down = AnimationUtils.loadAnimation(getApplicationContext(), R.anim.push_down);
anim_fade_in = AnimationUtils.loadAnimation(getApplicationContext(), R.anim.fade_in);
anim_push_down.setDuration(1400);
anim_fade_in.setDuration(1200);
s.addAnimation(anim_push_down);
s.addAnimation(anim_fade_in);
animating_view.startAnimation(s);
}
public void animate2(View animating_view) {
AnimationSet s = new AnimationSet(false);//false mean dont share interpolators
Animation anim_splash_push_up_in, anim_fade_in, anim_push_up;
anim_splash_push_up_in = AnimationUtils.loadAnimation(getApplicationContext(), R.anim.anim_splash_push_up_in);
anim_fade_in = AnimationUtils.loadAnimation(getApplicationContext(), R.anim.fade_in);
anim_splash_push_up_in.setDuration(1700);
anim_fade_in.setDuration(1900);
s.addAnimation(anim_splash_push_up_in);
s.addAnimation(anim_fade_in);
animating_view.startAnimation(s);
}
}
答案 0 :(得分:0)