Ich habe eine TextView
und ich versuche, eine Einblendung Animation hinzufügen. Mein Code gibt null
zurück und ich verstehe nicht warum.So fügen Sie eine Animation zu einer Textansicht in Android
Hier ist meine Implementierung
Dies ist die fade_in.xml
<alpha
xmlns:android="http://schemas.android.com/apk/res/android" android:fillAfter="true"
android:duration="1000"
android:fromAlpha="0.0"
android:interpolator="@android:anim/accelerate_interpolator"
android:toAlpha="1.0"/>
ist und hier ist, wie im es in der entsprechenden Aktivität
tv= (TextView)findViewById(R.id.textView);
//-- the below line is returning null
animation = AnimationUtils.loadAnimation(this,R.anim.fade_in);
animation.setAnimationListener(new Animation.AnimationListener() {
@Override
public void onAnimationStart(Animation animation) {
tv.setVisibility(View.VISIBLE);
}
@Override
public void onAnimationEnd(Animation animation) {
Intent it = new Intent(SplashActivity.this, MainActivity.class);
startActivity(it);
}
@Override
public void onAnimationRepeat(Animation animation) {
}
});
tv.startAnimation(animation);
Bitte geben Sie das Fehlerprotokoll. –
Bitte geben Sie hier den Logcat-Fehler ein. –