«onAnimationRepeat» не вызывается.
MainActivity. java
public class MainActivity extends AppCompatActivity {
@Override
protected void onCreate(Bundle savedInstanceState) {
super.onCreate(savedInstanceState);
setContentView(R.layout.activity_main);
Button button = findViewById(R.id.button);
button.setOnClickListener(new View.OnClickListener(){
@Override
public void onClick(View v) {
Animation anim = AnimationUtils.loadAnimation(getApplicationContext(), R.anim.scale);
anim.setAnimationListener(new Animation.AnimationListener() {
@Override
public void onAnimationStart(Animation animation) {
Log.d("@@","onAnimationStart");
}
@Override
public void onAnimationEnd(Animation animation) {
Log.d("@@","onAnimationEnd");
}
@Override
public void onAnimationRepeat(Animation animation) {
Log.d("@@","onAnimationRepeat");
}
});
View mainView = findViewById(R.id.main_layout);
mainView.startAnimation(anim);
}
});
}
}
макет / анимация / альфа. xml
<?xml version="1.0" encoding="utf-8"?>
<set xmlns:android="http://schemas.android.com/apk/res/android">
<alpha
android:fromAlpha="0.0"
android:toAlpha="1.0"
android:duration="500"
android:repeatCount="3"
/>
</set>
Activity_main. xml
logcat log
Я ожидал, что «onAnimationRepeat» будет напечатан
но не выводится.
почему?
Android Studio 3.6
Сборка # AI-192.7142.36.36.6200805, построена 12 февраля 2020 года
Рабочая версия: 1.8.0_212 -release-1586-b4-5784211 x86_64
ВМ: виртуальная машина OpenJDK с 64-разрядными серверами от JetBrains sro
macOS 10.14.6
G C: ParNew, ConcurrentMarkSweep
Память: 1981M
Количество ядер: 8
Реестр: ide.new.welcome.screen.force = true
Неупакованные плагины: