1.介绍

补间动画开发者只需指定动画开始,以及动画结束"关键帧", 而动画变化的"中间帧"则由系统计算并补齐!

2.去掉App的标题

(1)将AndroidManifest文件中Application标签中内容保持不变。

android:theme="@style/AppTheme"(即默认设置).

(2)修改values->styles.xml中的设置

将以下内容:

<style name="AppTheme" parent="Theme.AppCompat.Light.DarkActionBar">

替换为:

<resources>

    <!-- Base application theme. -->
<!--<style name="AppTheme" parent="Theme.AppCompat.Light.DarkActionBar">-->
<style name="AppTheme" parent="Theme.AppCompat.Light.NoActionBar">
<!-- Customize your theme here. -->
<item name="colorPrimary">@color/colorPrimary</item>
<item name="colorPrimaryDark">@color/colorPrimaryDark</item>
<item name="colorAccent">@color/colorAccent</item>
</style> </resources>

3.修改应用显示的图标

AndroidManifest文件中,将以下代码进行修改。

(1)修改前

<application
android:allowBackup="true"
android:icon="@mipmap/ic_launcher"
android:label="@string/app_name"
android:roundIcon="@mipmap/ic_launcher_round"
android:supportsRtl="true"
android:theme="@style/AppTheme">

(2)修改后

<application
android:allowBackup="true"
android:icon="@mipmap/icon_150"
android:label="@string/app_name"
android:roundIcon="@mipmap/ic_launcher_round"
android:supportsRtl="true"
android:theme="@style/AppTheme">

4.XML布局

<?xml version="1.0" encoding="utf-8"?>
<LinearLayout xmlns:android="http://schemas.android.com/apk/res/android"
xmlns:app="http://schemas.android.com/apk/res-auto"
xmlns:tools="http://schemas.android.com/tools"
android:layout_width="match_parent"
android:layout_height="match_parent"
android:orientation="vertical"
tools:context=".MainActivity"> <LinearLayout
android:layout_width="match_parent"
android:layout_height="wrap_content"
android:orientation="horizontal"> <Button
android:id="@+id/bt_touming"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:layout_weight="1"
android:text="透明" /> <Button
android:id="@+id/bt_xuanzhuan"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:layout_weight="1"
android:text="旋转" /> <Button
android:id="@+id/bt_suofang"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:layout_weight="1"
android:text="缩放" /> </LinearLayout> <LinearLayout
android:layout_width="match_parent"
android:layout_height="match_parent"
android:gravity="center"
android:orientation="horizontal"> <ImageView
android:id="@+id/imageView"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:layout_weight="1"
app:srcCompat="@mipmap/ic_launcher" />
</LinearLayout>
</LinearLayout>

5.java后台

package com.example.administrator.test60donghua;

import android.support.v7.app.AppCompatActivity;
import android.os.Bundle;
import android.view.View;
import android.view.animation.AlphaAnimation;
import android.view.animation.Animation;
import android.view.animation.RotateAnimation;
import android.view.animation.ScaleAnimation;
import android.widget.Button;
import android.widget.ImageView; public class MainActivity extends AppCompatActivity { Button bt_touming;
Button bt_xuanzhuan;
Button bt_suofang;
ImageView iv;
@Override
protected void onCreate(Bundle savedInstanceState) {
super.onCreate(savedInstanceState);
setContentView(R.layout.activity_main);
bt_touming=findViewById(R.id.bt_touming);
bt_xuanzhuan=findViewById(R.id.bt_xuanzhuan);
bt_suofang=findViewById(R.id.bt_suofang);
iv=findViewById(R.id.imageView); //透明动画
bt_touming.setOnClickListener(new View.OnClickListener() {
@Override
public void onClick(View v) {
//创建透明动画,1.0为完全不透明,0.0为完全透明
AlphaAnimation aa=new AlphaAnimation(1.0f,0.0f);
aa.setDuration(2000);//设置动画执行的时间
aa.setRepeatCount(1); //设置动画重复的次数
aa.setRepeatMode(Animation.REVERSE); //设置重复的模式
iv.startAnimation(aa); //开始执行动画
}
}); //旋转效果
bt_xuanzhuan.setOnClickListener(new View.OnClickListener() {
@Override
public void onClick(View v) {
RotateAnimation ra=new RotateAnimation(0,360,Animation.RELATIVE_TO_SELF,0.5f,Animation.RELATIVE_TO_SELF,0.5f);
ra.setDuration(2000);//设置动画执行的时间
ra.setRepeatCount(1); //设置动画重复的次数
ra.setRepeatMode(Animation.REVERSE); //设置重复的模式
iv.startAnimation(ra); //开始执行动画
}
}); bt_suofang.setOnClickListener(new View.OnClickListener() {
@Override
public void onClick(View v) {
ScaleAnimation sa=new ScaleAnimation(1.0f,2.0f,1.0f,2.0f,Animation.RELATIVE_TO_SELF,0.5f,Animation.RELATIVE_TO_SELF,0.5f);
sa.setDuration(2000);//设置动画执行的时间
sa.setRepeatCount(1); //设置动画重复的次数
sa.setRepeatMode(Animation.REVERSE); //设置重复的模式
iv.startAnimation(sa); //开始执行动画
}
}); }
}

6.效果图

012 Android 动画效果(补间动画) +去掉App默认自带的标题+更改应用的图标的更多相关文章

  1. View动画(补间动画)

    补间动画的属性 Animation的属性 JAVA方法 XML属性 解释 setDetachWallpaper(boolean) android:detachWallpaper 是否在壁纸上运行 se ...

  2. Android动画总结#补间动画(Tween Animation/View Animation) #帧动画(Frame Animation/Drawable Animation)#属性动画(PropertyAnimation)

    1.共有三种动画,英文名字多种叫法如下 第一种动画:补间动画(Tween Animation/View Animation) 四个:RotateAnimation旋转. AlphaAnimation透 ...

  3. Android开发(26)--补间动画(Tween)的实现

    补间动画(Tween Animation) 补间动画与逐帧动画在本质上是不同的,逐帧动画通过连续播放图片来模拟动画的效果,而补间动画则是通过在两个关键帧之间补充渐变的动画效果来实现的.补间动画的优点是 ...

  4. Android中的帧动画与补间动画的使用

    前言 在日常开发中,我们有时候须要一些好看的动画效果,这时能够充分利用Android提供的这几种动画来实现. Android提供了3种类型的动画: 补间动画:补间动画能够应用于View,让你能够定义一 ...

  5. Android动画系列之帧动画和补间动画

    原文首发于微信公众号:jzman-blog,欢迎关注交流! Android 提供三种动画:帧动画.补间动画和属性动画,本篇文章介绍帧动画以及补间动画的使用,属性动画的使用将在后面的文章中分享,那就来复 ...

  6. android104 帧动画,补间动画,属性动画

    ##帧动画FrameAnimation* 多张图片快速切换,形成动画效果* 帧动画使用xml定义 package com.itheima.frameanimation; import android. ...

  7. Android 深入ViewPager补间动画,实现类京东商城首页广告Banner切换效果

    如有转载,请声明出处: 时之沙: http://blog.csdn.net/t12x3456 某天看到京东商城首页的滑动广告的Banner,在流动切换的时候有立体的动画效果,感觉很有意思,然后研究了下 ...

  8. Android开发之补间动画、XML方式定义补间动画

    四种补间动画: 1.透明: 2.缩放: 3.位移: 4.旋转: //点击按钮 实现iv 透明的效果 动画 public void click1(View v) { //1.0意味着着完全不透明 0.0 ...

  9. android 学习随笔二十五(动画:补间动画)

    补间动画(TweenAnimation) * 原形态变成新形态时为了过渡变形过程,生成的动画就叫补间动画(为了让对象从初始状态向结束状态改变的过程更加自然而自动生成的动画效果)* 位移.旋转.缩放.透 ...

随机推荐

  1. AtCoder Grand Contest 030 (AGC030) F - Permutation and Minimum 动态规划

    原文链接www.cnblogs.com/zhouzhendong/p/AGC030F.html 草率题解 对于每两个相邻位置,把他们拿出来. 如果这两个相邻位置都有确定的值,那么不管他. 然后把所有的 ...

  2. intellij idea tomcat 启动不生成war包

    intellij idea tomcat 启动不生成war包 想把项目打包成war包做测试,但是按照之前的方法居然没有成功导出war包,犯了很低级的错误,特此记录. (1)首先在Project Str ...

  3. JPA 原生SQ查询

    参考文章 https://blog.csdn.net/coding_1994/article/details/84575943 https://blog.csdn.net/m0_37776094/ar ...

  4. Unity火爆插件Behavior Designer行为树插件学习

    如果要让游戏里的角色或者NPC能执行预设的AI逻辑,最简单的用IF..ELSE...神器既可以实现, 但是再复杂的一般用经典的状态机来切换状态,但是写起来比较麻烦.相对的,行为树(Behavior T ...

  5. 自然语言处理中注意力机制---Attention

    使用Multi-head Self-Attention进行自动特征学习的CTR模型 https://blog.csdn.net/u012151283/article/details/85310370 ...

  6. JS如何判断文字是全角还是半角

    载自:http://www.php.cn/js-tutorial-362638.html 全角:是一种电脑字符,是指一个全角字符占用两个标准字符(或两个半角字符)的位置.全角占两个字节.半角:是指一个 ...

  7. vim支持golang函数调整

    golang函数跳转需要借助godef实现 godef安装如下 go get -v github.com/rogpeppe/godef go install -v github.com/rogpepp ...

  8. Windows上安装nodejs版本管理器nvm 安装成功之后重启终端失效

    nvm 安装成功之后重启终端失效(command not found) 安装nvm之后node不可用,“node”不是内部或外部命令,也不是可运行的程序或批处理文件(ng) 安装nvm: 下载nvm压 ...

  9. git如何查找某个包含指定字符串的commit hash值?

    答: git shortlog --format='%H|%cn|%s' | grep '需要查找的字符串内容'

  10. Flutter 图片、圆形头像、圆角图片....各种形状

    图片 1. 本地图片 Image.asset 加载项目资源包的图片 //先将图片拷贝到项目 images 目录中,然后在 pubspec.yaml文件配置文件相对路径到 assets Image.as ...