Ich versuche einen Text zu animieren, der über einer anderen Ansicht herauszoomt. Mein Code sieht ungefähr so aus:Wie animiere ich Text über eine andere Ansicht in Android?
class BoardView extends View {
private TextView animText;
...
private void animText(String text, int color, int xBlocks, int yBlocks) {
animText.setText(text);
animText.setTextColor(color);
animText.setVisibility(View.VISIBLE);
final int x = BOARD_X_OFFSET + xBlocks * xBlockSize;
final int y = BOARD_Y_OFFSET + yBlocks * yBlockSize;
final float SCALE_FROM = (float) 0.25;
final float SCALE_TO = (float) 5.0;
ScaleAnimation anim = new ScaleAnimation(SCALE_FROM, SCALE_TO, SCALE_FROM, SCALE_TO, x, y);
anim.setDuration(500);
animText.setAnimation(anim);
this.setAnimation(null);
startAnimation(anim);
}
}
mit animText in der onDraw()
Routine der BoardView
aufgerufen wird. Was ich aber sehe, ist die Platine herauszoomen, nicht der Text, trotz der oben genannten Anrufe zu setAnimation()
.
Ich habe in der Haupt Android-Dokumente und bei einer anderen example gesucht. Selbst Hinweise in die richtige Richtung wären hilfreich.