您现在的位置是:群英 > 开发技术 > 移动开发
Android Studio补间动画的操作是什么
Admin发表于 2022-04-28 17:17:32803 次浏览
这篇文章给大家分享的是“Android Studio补间动画的操作是什么”,文中的讲解内容简单清晰,对大家学习和理解有一定的参考价值和帮助,有这方面学习需要的朋友,接下来就跟随小编一起学习一下“Android Studio补间动画的操作是什么”吧。


下面实例为大家分享了Android Studio实现补间动画的具体代码,供大家参考,具体内容如下

补间动画是给出初始位置和结束位置,中间由系统自动补充的动画

1、补间动画的配置文件:scale.xml

2、布局文件:animal_patching.xml

3、main.java

sacle.xml

<?xml version="1.0" encoding="utf-8"?>
<set xmlns:android="http://schemas.android.com/apk/res/android">
    <scale
        android:duration="3000"(运动时间)
        android:toYScale="0.5"(结束大小)
        android:toXScale="0.5"
        android:pivotY="50%"(运动中心位置)
        android:pivotX="50%"
        android:fromXScale="1"(初始大小)
        android:fromYScale="1"/>
</set>

animal_patching

<?xml version="1.0" encoding="utf-8"?>
<LinearLayout
    android:layout_width="match_parent"
    android:layout_height="match_parent"
    android:orientation="vertical"
    android:gravity="center"
    xmlns:android="http://schemas.android.com/apk/res/android">
    <ImageView
        android:id="@+id/image"
        android:background="@drawable/boy"
        android:layout_width="wrap_content"
        android:layout_height="wrap_content"/>
</LinearLayout>

main.java

package com.example.imageview;

import androidx.appcompat.app.AppCompatActivity;

import android.os.Bundle;
import android.view.View;
import android.view.animation.Animation;
import android.view.animation.AnimationUtils;
import android.widget.ImageView;

public class MainActivity<i> extends AppCompatActivity {
    /*
    private static final String TAG = "leo";
    private NotificationManager manager;
    private Notification notification;
    private PopupWindow popupWindow;
    //创建一个数组,内部元素为Bean类型;
    private List<Bean> data = new ArrayList<>();
     */
    private boolean flag = true;
    @Override
    protected void onCreate(Bundle savedInstanceState) {
        super.onCreate(savedInstanceState);
        setContentView(R.layout.cartoon_patching);

        ImageView imageView = findViewById(R.id.image);

        imageView.setOnClickListener(new View.OnClickListener() {
            @Override
            public void onClick(View view) {
                //透明度***********************************
//                Animation animation = AnimationUtils.loadAnimation(MainActivity.this,R.anim.alpad_1);
//                imageView.startAnimation(animation);
                //旋转************************************
//                Animation animation = AnimationUtils.loadAnimation(MainActivity.this,R.anim.rotate);
//                imageView.startAnimation(animation);
                //大小缩放**********************************
//                Animation animation = AnimationUtils.loadAnimation(MainActivity.this,R.anim.scale);
//                imageView.startAnimation(animation);
                //平移************************************
                Animation animation = AnimationUtils.loadAnimation(MainActivity.this,R.anim.translate);
                imageView.startAnimation(animation);
            }
        });


}

以上就是关于“Android Studio补间动画的操作是什么”的相关知识,感谢各位的阅读,想要掌握这篇文章的知识点还需要大家自己动手实践使用过才能领会,如果想了解更多相关内容的文章,欢迎关注群英网络,小编每天都会为大家更新不同的知识。

免责声明:本站发布的内容(图片、视频和文字)以原创、转载和分享为主,文章观点不代表本网站立场,如果涉及侵权请联系站长邮箱:mmqy2019@163.com进行举报,并提供相关证据,查实之后,将立刻删除涉嫌侵权内容。

标签: Studio
相关信息推荐
2022-06-16 09:27:12 
摘要:替换方法:1、用“array_replace(数组,替换数组)”,可用后面数组的元素替换第一个数组的元素。2、用“array_splice(数组,开始位置,个数,替换值)”,从指定位置开始替换指定个数的元素,若替换多个值,则替换值可是数组。
2022-11-04 18:40:10 
摘要:这篇文章主要介绍了YII2框架中日志的配置与使用方法,结合实例形式分析了YII2框架中日志的功能、配置方法及使用相关操作技巧,需要的朋友可以参考下
2022-07-01 17:31:23 
摘要:golang反向代理无法访问的解决方法:可以将NewSingleHostReverseProxy函数拷贝出来进行修改,然后在需要用到反向代理结构体的地方用我们自定义的函数新建代理器。
云活动
推荐内容
热门关键词
热门信息
群英网络助力开启安全的云计算之旅
立即注册,领取新人大礼包
  • 联系我们
  • 24小时售后:4006784567
  • 24小时TEL :0668-2555666
  • 售前咨询TEL:400-678-4567

  • 官方微信

    官方微信
Copyright  ©  QY  Network  Company  Ltd. All  Rights  Reserved. 2003-2019  群英网络  版权所有   茂名市群英网络有限公司
增值电信经营许可证 : B1.B2-20140078   粤ICP备09006778号
免费拨打  400-678-4567
免费拨打  400-678-4567 免费拨打 400-678-4567 或 0668-2555555
微信公众号
返回顶部
返回顶部 返回顶部