我想使用ScaleAnimation(编程不以xml)来改变高度,以查看从0至60%母体高度。宽度的观点是不变的,是50像素。视图是空只背景颜色设置。
I want to use ScaleAnimation (programmatically not in xml) to change height to view from 0 to 60% of parent height. Width of view is constant and is 50px. View is empty only background color is set.
有人可以给我$ C $下 scaleAnim
使用ScaleAnimation从code。
Can someone give me code for scaleAnim
using ScaleAnimation from code.
<LinearLayout xmlns:android="http://schemas.android.com/apk/res/android"
android:orientation="vertical"
android:layout_width="fill_parent"
android:layout_height="fill_parent"
android:id="@+id/layContainer
>
<View
android:layout_width="50px"
android:layout_height="fill_parent"
android:id="@+id/viewContainer"
android:background:"#00f00"
/>
</LinearLayout>
ScaleAnimation scaleAnim = new ScaleAnimation(...);
查看之前和动画后 .Thanks
view before and after animation .Thanks
试试这个code形成规模的动画,而无需使用XML
try this code to create Scale animation without using xml
ScaleAnimation animation = new ScaleAnimation(fromXscale, toXscale, fromYscale, toYscale, Animation.RELATIVE_TO_SELF, (float)0.5, Animation.RELATIVE_TO_SELF, (float)0.5);