Reputation: 817
I have a text view with background color. I want to enlarge/project the whole view using animation. I tried with scale animation only text gets enlarged.I want the whole view to get enlarged. Which animation should I use to attain this? Provide suggestions.
Upvotes: 0
Views: 3140
Reputation: 5440
Add your textview to a relative layout.And apply animation to that layout.
xml:
<RelativeLayout
android:layout_width="300dp"
android:id="@+id/mylayout"
android:layout_height="50dp"
android:layout_alignParentTop="true"
android:layout_centerHorizontal="true"
android:layout_marginTop="218dp"
android:background="#000" >
<TextView
android:id="@+id/textView1"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:layout_centerHorizontal="true"
android:layout_centerVertical="true"
android:text="TextView"
android:textColor="#fff" />
</RelativeLayout>
Java:
ScaleAnimation animation = new ScaleAnimation(fromXscale, toXscale, fromYscale, toYscale, Animation.RELATIVE_TO_SELF, (float)0.5, Animation.RELATIVE_TO_SELF, (float)0.5);
RelativeLayout rl=(RelativeLayout)findViewById(R.id.mylayout);
rl.startAnimation(animation);
Upvotes: 2
Reputation: 309
You can insert the textView in relative layout, set the id of relative Layout and do the scale animation to the relative Layout....
Upvotes: 0