0

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.

4

2 回答 2

2

将您的文本视图添加到相对布局。并将动画应用于该布局。

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>

爪哇:

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);
于 2013-05-20T12:06:00.380 回答
0

您可以在相对布局中插入 textView,设置相对布局的 id 并对相对布局进行缩放动画...。

于 2013-05-20T12:05:20.973 回答