Android   发布时间:2022-04-28  发布网站:大佬教程  code.js-code.com
大佬教程收集整理的这篇文章主要介绍了android图像视图缩放动画大佬教程大佬觉得挺不错的,现在分享给大家,也给大家做个参考。
我想知道如何缩放徽标的动画并移动其位置?

我有一个if语句运行一些检查,然后当它完成时,我希望它缩小图像视图(徽标)并将其向上移动.

继承我的布局

<?xml version="1.0" encoding="utf-8"?>
<RelativeLayout xmlns:android="http://scheR_236_11845@as.android.com/apk/res/android"
    android:layout_width="fill_parent"
    android:layout_height="fill_parent"
    android:orientation="vertical"
    android:BACkground="@drawable/bg_default" >

    <ImageView
        android:id="@+id/su_logo"
        android:layout_width="wrap_content"
        android:layout_height="wrap_content"
        android:layout_alignParentTop="true"
        android:layout_centerHorizontal="true"
        android:layout_marginTop="34dp"
        android:src="@drawable/su_logo" 
        android:contentDescription="@String/cd_su_logo"/>

    <ImageView
        android:id="@+id/su_shirts"
        android:layout_width="wrap_content"
        android:layout_height="wrap_content"
        android:layout_alignParentBottom="true"
        android:layout_centerHorizontal="true"
        android:src="@drawable/su_shirts"
        android:contentDescription="@String/cd_su_shirts" />

</RelativeLayout>

继承我的java

public void onCreate(Bundle savedInstanceStatE) {
        super.onCreate(savedInstanceStatE);
        setContentView(R.layout.layout_initialsetup);
        prechecks();
    }

public void prechecks(){
    //check for internet connection

    //check version
    String curVersion = getresources().getString(R.String.app_versionCodE);
    int curVer = Integer.parseInt(curVersion);  
    String LiveVersion = "100";
    int liveVer = Integer.parseInt(LiveVersion);

    if(curVer < liveVer) Log.v("setup","There is a new version");  
    else { 

        //scale animation


    }   




}

解决方法

您可以通过在AnimationSet中一起应用ScaleAnimation和TranslateAnimation来实现
// Scaling
Animation scale = new ScaleAnimation(fromXscale,toXscale,fromYscale,toYscale,Animation.RELATIVE_TO_SELF,0.5f,0.5f);
// 1 second duration
scale.setDuration(1000);
// Moving up
Animation slideUp = new TranslateAnimation(fromX,toX,fromY,toY);
// 1 second duration
slideUp.setDuration(1000);
// Animation set to join both scaling and moving
AnimationSet animSet = new AnimationSet(true);
animSet.setFillEnabled(true);
animSet.addAnimation(scalE);
animSet.addAnimation(slideUp);
// Launching animation set
logo.startAnimation(animSet);

大佬总结

以上是大佬教程为你收集整理的android图像视图缩放动画全部内容,希望文章能够帮你解决android图像视图缩放动画所遇到的程序开发问题。

如果觉得大佬教程网站内容还不错,欢迎将大佬教程推荐给程序员好友。

本图文内容来源于网友网络收集整理提供,作为学习参考使用,版权属于原作者。
如您有任何意见或建议可联系处理。小编QQ:384754419,请注明来意。