編輯:關於android開發
1. 新建個位移動畫的xml文件
Activity中開啟動畫
使用AnimationUtils類加載動畫資源文件
left_to_right.xml
<?xml version="1.0" encoding="utf-8"?>
<translate xmlns:android="http://schemas.android.com/apk/res/android"
android:fromXDelta="100%"
android:toXDelta="0"
android:duration="3000"
>
</translate>
View child=new IndexView(this).getMemberView(); child.startAnimation(AnimationUtils.loadAnimation(this, R.anim.left_to_right));
2. 淡入淡出動畫
當前淡出界面和執行時間
淡出過程中,淡入界面處於等待狀態
第二個界面淡入和他的執行時間
第一個界面執行完成後,要刪除掉
package com.tsh.lottery.utils;
import android.support.v4.view.ViewPager;
import android.view.View;
import android.view.ViewGroup;
import android.view.ViewParent;
import android.view.animation.AlphaAnimation;
import android.view.animation.Animation;
import android.view.animation.Animation.AnimationListener;
public class FadeUtil {
/**
* 淡出界面
* @param view 界面
* @param duration 執行時間
*/
public static void fadeOut(final View view,long duration){
AlphaAnimation alphaAnimation=new AlphaAnimation(1, 0);
alphaAnimation.setDuration(duration);
view.startAnimation(alphaAnimation);
//監聽動畫結束,刪除View元素
alphaAnimation.setAnimationListener(new AnimationListener() {
@Override
public void onAnimationStart(Animation animation) {
}
@Override
public void onAnimationRepeat(Animation animation) {
}
@Override
public void onAnimationEnd(Animation animation) {
ViewGroup vg=(ViewGroup) view.getParent();
vg.removeView(view);
}
});
}
/**
* 淡入界面
* @param view 界面
* @param delay 延遲時間
* @param duration 執行時間
*/
public static void fadeIn(View view,long delay,long duration){
AlphaAnimation alphaAnimation=new AlphaAnimation(0, 1);
//設置開始時間延遲
alphaAnimation.setStartOffset(delay);
alphaAnimation.setDuration(duration);
view.startAnimation(alphaAnimation);
}
}
FadeUtil.fadeOut(child, 2000);
FadeUtil.fadeIn(child, 2000,2000);
Android SQL語句實現數據庫的增刪改查,androidsql
Android SQL語句實現數據庫的增刪改查,androidsql本文介紹android中的數據庫的增刪改查 復習sql語法: * 增 insert into info
android studio 使用checkstyle全攻略
android studio 使用checkstyle全攻略 步驟: 1.https://github.com/android/platform_development/
Android自定義控件4--優酷菜單的菜單鍵及細節補充,android4--
Android自定義控件4--優酷菜單的菜單鍵及細節補充,android4--在上篇文章中實現了優酷菜單執行動畫,本文接著完善已經實現的動畫功能 本文地址:http://
[android] 標題部分管理,android標題
[android] 標題部分管理,android標題 1.1 普通標題 1.1.1 標題內容管理 1.1.2 幫助和返回的按鈕 1.2 未登錄的標題 1.3