Android Studio實(shí)現(xiàn)補(bǔ)間動(dòng)畫
本文實(shí)例為大家分享了Android Studio實(shí)現(xiàn)補(bǔ)間動(dòng)畫的具體代碼,供大家參考,具體內(nèi)容如下
補(bǔ)間動(dòng)畫是給出初始位置和結(jié)束位置,中間由系統(tǒng)自動(dòng)補(bǔ)充的動(dòng)畫
1、補(bǔ)間動(dòng)畫的配置文件: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"(運(yùn)動(dòng)時(shí)間)
android:toYScale="0.5"(結(jié)束大?。?
android:toXScale="0.5"
android:pivotY="50%"(運(yùn)動(dòng)中心位置)
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;
//創(chuàng)建一個(gè)數(shù)組,內(nèi)部元素為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);
//旋轉(zhuǎn)************************************
// 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);
}
});
}
以上就是本文的全部?jī)?nèi)容,希望對(duì)大家的學(xué)習(xí)有所幫助,也希望大家多多支持腳本之家。
相關(guān)文章
android獲取手機(jī)IMSI碼判斷手機(jī)運(yùn)營(yíng)商代碼實(shí)例
這篇文章主要介紹了android獲取手機(jī)IMSI碼判斷手機(jī)運(yùn)營(yíng)商代碼實(shí)例,大家參考使用2013-11-11
Java語言讀取配置文件config.properties的方法講解
今天小編就為大家分享一篇關(guān)于Java語言讀取配置文件config.properties的方法講解,小編覺得內(nèi)容挺不錯(cuò)的,現(xiàn)在分享給大家,具有很好的參考價(jià)值,需要的朋友一起跟隨小編來看看吧2019-03-03
Android自定義View實(shí)現(xiàn)驗(yàn)證碼
這篇文章主要為大家詳細(xì)介紹了Android自定義View實(shí)現(xiàn)驗(yàn)證碼的相關(guān)資料,具有一定的參考價(jià)值,感興趣的小伙伴們可以參考一下2016-10-10
深入Android 五大布局對(duì)象的應(yīng)用
本篇文章小編為大家介紹,深入Android 五大布局對(duì)象的應(yīng)用。需要的朋友參考下2013-04-04
Android實(shí)現(xiàn)登錄功能demo示例
這篇文章主要介紹了Android實(shí)現(xiàn)登錄功能demo示例,涉及登錄信息操作、界面布局、登錄邏輯判斷等相關(guān)操作技巧,需要的朋友可以參考下2016-07-07
Android 中TextView中跑馬燈效果的實(shí)現(xiàn)方法
這篇文章主要介紹了Android 中TextView中跑馬燈效果的實(shí)現(xiàn)方法,非常不錯(cuò),具有參考借鑒價(jià)值,需要的朋友可以參考下2017-02-02
Android使用ViewDragHelper實(shí)現(xiàn)QQ聊天氣泡拖動(dòng)效果
這篇文章主要為大家詳細(xì)介紹了Android使用ViewDragHelper實(shí)現(xiàn)QQ聊天氣泡拖動(dòng)效果,文中示例代碼介紹的非常詳細(xì),具有一定的參考價(jià)值,感興趣的小伙伴們可以參考一下2019-01-01
Android如何實(shí)現(xiàn)接收和發(fā)送短信
這篇文章主要為大家詳細(xì)介紹了Android如何實(shí)現(xiàn)接收和發(fā)送短信,具有一定的實(shí)用性,感興趣的小伙伴們可以參考一下2016-08-08

