第七色在线视频,2021少妇久久久久久久久久,亚洲欧洲精品成人久久av18,亚洲国产精品特色大片观看完整版,孙宇晨将参加特朗普的晚宴

為了賬號(hào)安全,請(qǐng)及時(shí)綁定郵箱和手機(jī)立即綁定

Android動(dòng)畫分類演示簡單代碼

標(biāo)簽:
Android

1.activity.main.xml

<LinearLayout xmlns:android="http://schemas.android.com/apk/res/android"

    xmlns:tools="http://schemas.android.com/tools"

    android:layout_width="match_parent"

    android:layout_height="match_parent"

    android:orientation="vertical"

    >

    <ImageView

         android:id="@+id/iv_show"

        android:layout_width="match_parent"

        android:layout_height="wrap_content"

        />

    <Button 

        android:id="@+id/btn01"

        android:text="透明度动画"

        android:layout_width="match_parent"

        android:layout_height="wrap_content"

        />

     <Button 

          android:id="@+id/btn02"

           android:text="渐变动画"

        android:layout_width="match_parent"

        android:layout_height="wrap_content"

        />

      <Button 

           android:id="@+id/btn03"

            android:text="位移动画"

        android:layout_width="match_parent"

          android:layout_height="wrap_content"

        />

       <Button 

            android:id="@+id/btn04"

             android:text="旋转动画"

        android:layout_width="match_parent"

          android:layout_height="wrap_content"

        />

        <Button 

             android:id="@+id/btn05"

              android:text="动画集"

        android:layout_width="match_parent"

         android:layout_height="wrap_content"

        />

</LinearLayout>

2.MainActivity.java

package com.example.android_animation;

import android.os.Bundle;

import android.app.Activity;

import android.view.Menu;

import android.view.View;

import android.view.View.OnClickListener;

import android.view.animation.AlphaAnimation;

import android.view.animation.Animation;

import android.view.animation.AnimationSet;

import android.view.animation.RotateAnimation;

import android.view.animation.ScaleAnimation;

import android.view.animation.TranslateAnimation;

import android.widget.Button;

import android.widget.ImageView;

public class MainActivity extends Activity implements OnClickListener{

    private ImageView ivShow;

    private Button btn01,btn02,btn03,btn04,btn05;

    private Animation animation;//动画抽象类

    private Animation aPha;//透明度

    private Animation scale;//缩放动画

    @Override

    protected void onCreate(Bundle savedInstanceState) {

        super.onCreate(savedInstanceState);

        setContentView(R.layout.activity_main);

        ivShow=(ImageView) findViewById(R.id.iv_show);

        ivShow.setImageResource(R.drawable.ic_login2);

        

        btn01=(Button) findViewById(R.id.btn01);

        btn02=(Button) findViewById(R.id.btn02);

        btn03=(Button) findViewById(R.id.btn03);

        btn04=(Button) findViewById(R.id.btn04);

        btn05=(Button) findViewById(R.id.btn05);

        

        btn01.setOnClickListener(this);

        btn02.setOnClickListener(this);

        btn03.setOnClickListener(this);

        btn04.setOnClickListener(this);

        btn05.setOnClickListener(this);

        

        btn01.setOnClickListener(new OnClickListener() {

@Override

public void onClick(View v) {

animation=new AlphaAnimation(0.1f, 1.0f);

animation.setDuration(3000);

ivShow.startAnimation(animation);

}

});

        

    }

@Override

public void onClick(View v) {

switch (v.getId()) {

case R.id.btn01://透明度变化

animation=new AlphaAnimation(0.1f, 1.0f);

animation.setDuration(3000);

ivShow.startAnimation(animation);

break;

        case R.id.btn02://缩放动画

animation=new ScaleAnimation(0.1f, 1.0f, 0.1f, 1.0f);

animation.setDuration(2000);

ivShow.startAnimation(animation);

break;

        case R.id.btn03:

        animation=new TranslateAnimation(0.1f, 100.0f,1.0f, 100.0f);

         animation.setDuration(3000);

         ivShow.startAnimation(animation);

        break;

        case R.id.btn04:

         animation=new RotateAnimation(0, 360);

        animation.setDuration(2000);

        ivShow.startAnimation(animation);

         break;

        case R.id.btn05:

         aPha=new AlphaAnimation(0.1f, 1.0f);

         animation=new TranslateAnimation(0.1f, 100.0f,1.0f, 100.0f);

         scale=new ScaleAnimation(0.1f, 1.0f, 0.1f, 1.0f);

        

         AnimationSet set=new AnimationSet(true);

         set.addAnimation(aPha);

         set.addAnimation(scale);

         set.addAnimation(animation);

        

         set.setDuration(3000);

         ivShow.startAnimation(set);

         break;

default:

break;

}

}

   

    

}

原文链接:http://www.apkbus.com/blog-813041-62890.html

點(diǎn)擊查看更多內(nèi)容
TA 點(diǎn)贊

若覺得本文不錯(cuò),就分享一下吧!

評(píng)論

作者其他優(yōu)質(zhì)文章

正在加載中
  • 推薦
  • 評(píng)論
  • 收藏
  • 共同學(xué)習(xí),寫下你的評(píng)論
感謝您的支持,我會(huì)繼續(xù)努力的~
掃碼打賞,你說多少就多少
贊賞金額會(huì)直接到老師賬戶
支付方式
打開微信掃一掃,即可進(jìn)行掃碼打賞哦
今天注冊(cè)有機(jī)會(huì)得

100積分直接送

付費(fèi)專欄免費(fèi)學(xué)

大額優(yōu)惠券免費(fèi)領(lǐng)

立即參與 放棄機(jī)會(huì)
微信客服

購課補(bǔ)貼
聯(lián)系客服咨詢優(yōu)惠詳情

幫助反饋 APP下載

慕課網(wǎng)APP
您的移動(dòng)學(xué)習(xí)伙伴

公眾號(hào)

掃描二維碼
關(guān)注慕課網(wǎng)微信公眾號(hào)

舉報(bào)

0/150
提交
取消