Android的大规模动画的看法 [英] Android scale animation on view

查看:139
本文介绍了Android的大规模动画的看法的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我想使用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);

这篇关于Android的大规模动画的看法的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆