Scaling animation is used to scale a view. In Android, you can apply this scaling effect to almost anything, from simple text, to images, buttons, etc…
Here simply I will explain a scaling textview which you can apply to other views also... In res/anim/scale.xml
Here simply I will explain a scaling textview which you can apply to other views also... In res/anim/scale.xml
<?xml version="1.0" encoding="utf-8"?> <set xmlns:android="http://schemas.android.com/apk/res/android" android:interpolator="@android:anim/linear_interpolator"> <scale android:fromXScale="0.0" android:toXScale="1.0" android:fromYScale="0.0" android:toYScale="1.0" android:pivotX="50%" android:pivotY="50%" android:duration="2000" /> </set>Java source code is given below
public class Textviewanimation extends Activity { Animation fadeIn,fadeOut; TextView tv; Button startanimation; @Override public void onCreate(Bundle savedInstanceState) { super.onCreate(savedInstanceState); setContentView(R.layout.activity_textviewanimation); tv=(TextView) findViewById(R.id.textview); startanimation=(Button) findViewById(R.id.button1); tv.setText("This is an animated textview"); final Animation Scale = AnimationUtils.loadAnimation(this,R.anim.scale); startanimation.setOnClickListener(new OnClickListener() { @Override public void onClick(View arg0) { tv.startAnimation(Scale); } }); } }
see more:
Comments
Post a Comment