Reputation: 15734
I would like to know how to make a very quick and simple ScaleAnimation
in Android on a TextView
that does this:
User clicks on a submit button
and a TextView
Gets two times the size and returns back to normal. I would like to see this smooth transition in Text Size. So I'd like to watch it grow and then shrink.
Not sure if I can do this without an XML
file or if it is better with?
Upvotes: 0
Views: 972
Reputation: 5796
What you are asking for is similar to the following tutorial, which shows how to run an animation that increases the size of a textView when selected. The code shown below is taken from said tutorial.
The animation file can be defined in xml as following:
<?xml version="1.0" encoding="utf-8"?>
<scale xmlns:android="http://schemas.android.com/apk/res/android"
android:fromXScale="0.5"
android:toXScale="2.0"
android:fromYScale="0.5"
android:toYScale="2.0"
android:pivotX="0%"
android:pivotY="50%"
android:startOffset="0"
android:duration="400"
android:fillBefore="true" />
Not sure if I can do this without an XML file or if it is better with?
The only reason to do it in Java is because you have to compute the values for scaling the view. Other than that, go with xml.
Upvotes: 1