I want to make text size bigger when I click on TextView and I have code like
/res/anim/scale_up.xml
<?xml version="1.0" encoding="utf-8"?>
<set xmlns:android="http://schemas.android.com/apk/res/android" >
<scale
android:duration="500"
android:fromXScale="1.0"
android:fromYScale="1.0"
android:toXScale="1.3"
android:toYScale="1.3" >
</scale>
</set>
and in code like
txt.setOnClickListener(new OnClickListener() {
public void onClick(View v) {
Animation a = AnimationUtils.loadAnimation(SwipeActivity.this, R.anim.scale_up);
a.reset();
v.clearAnimation();
v.startAnimation(a);
}
});
and it scales but when it finishes scaling (500ms) it comes back on old size of font. How to prevent that, I want to stay doubled size ?
First off you could set the textsize to the TextView instad of using an animation. Animating it will make the text blurred.
eks:
textView.setTextSize(20);
The reason why the animation pops back to the original size is because you don´t use setFillAfter.