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. TCP协议怎么工作的?

    三次握手过程: 第一次 第一次握手:建立连接时,客户端发送syn包(syn=j)到服务器,并进入SYN_SENT状态,等待服务器确认:SYN:同步序列编号(Synchronize Sequence N ...

  2. 「ZJOI2019」线段树

    传送门 Description 线段树的核心是懒标记,下面是一个带懒标记的线段树的伪代码,其中 tag 数组为懒标记: 其中函数\(Lson(Node)\)表示\(Node\)的左儿子,\(Rson( ...

  3. POJ1635 Subway tree systems ——(判断树的同构,树的最小表示法)

    给两棵有根树,判断是否同构.因为同构的树的最小表示法唯一,那么用最小表示法表示这两棵树,即可判断同构.顺便如果是无根树的话可以通过选出重心以后套用之前的方法. AC代码如下: #include < ...

  4. JVM命令行参数

    root@ubuntu-blade2:/sdf/jdk# javaUsage: java [-options] class [args...] (to execute a class) or java ...

  5. Java逻辑分页代码

    前台jsp代码如下: <%@ page language="java" contentType="text/html; charset=UTF-8" pa ...

  6. 启动项目报错:Unsupported major.minor version 52.0

    解决方案: 确保Build Path或者电脑配置的环境变量版本号,和pom中的一致 Exception in thread "main" java.lang.Unsupported ...

  7. Oracle中的统计信息

    一.什么是统计信息 统计信息主要是描述数据库中表,索引的大小,规模,数据分布状况等的一类信息.例如,表的行数,块数,平均每行的大小,索引的leaf blocks,索引字段的行数,不同值的大小等,都属于 ...

  8. Springmvc & Report: FineReport vs BIRT vs Jasperreport

    Springmvc与jasperreport结合生成报表的一种方法 - OneThin的个人空间 - OSCHINAhttps://my.oschina.net/onethin/blog/14360 ...

  9. System.Runtime.Serialization.cs

    ylbtech-System.Runtime.Serialization.cs 允许对象控制其自己的序列化和反序列化过程. 1.返回顶部 1. #region 程序集 mscorlib, Versio ...

  10. pyenv、virtualenv、virtualenvwrapper三种python多版本介绍

    今天有把此前接触过的三种python实现多版本环境用到的软件pyenv.virtualenv.virtualenvwrapper,了解了一番,现做如下总结: 一.pyenv: 是针对python多版本 ...