android欢迎界面动画加载
来源:互联网 发布:影楼美工工资一般多少 编辑:程序博客网 时间:2024/04/29 07:42
欢迎界面 WelcomeActivity .java
public class WelcomeActivity extends Activity implements AnimationListener {
private ImageView imageView = null;
private Animation alphaAnimation = null;
@Override
protected void onCreate(Bundle savedInstanceState) {
super.onCreate(savedInstanceState);
setContentView(R.layout.welcome);
imageView = (ImageView)findViewById(R.id.welcome_image_view);
alphaAnimation = AnimationUtils.loadAnimation(this, R.anim.welcome_alpha);
alphaAnimation.setFillEnabled(true); //启动Fill保持
alphaAnimation.setFillAfter(true); //设置动画的最后一帧是保持在View上面
imageView.setAnimation(alphaAnimation);
alphaAnimation.setAnimationListener(this); //为动画设置监听
}
@Override
public void onAnimationStart(Animation animation) {
}
@Override
public void onAnimationEnd(Animation animation) {
//动画结束时结束欢迎界面并转到软件的主界面
Intent intent = new Intent(this, MainActivity.class);
startActivity(intent);
this.finish();
}
@Override
public void onAnimationRepeat(Animation animation) {
}
@Override
public boolean onKeyDown(int keyCode, KeyEvent event) {
//在欢迎界面屏蔽BACK键
if(keyCode==KeyEvent.KEYCODE_BACK) {
return false;
}
return false;
}
}
登录后的主界面MainActivity .java
public class MainActivity extends Activity {
@Override
protected void onCreate(Bundle savedInstanceState) {
super.onCreate(savedInstanceState);
setContentView(R.layout.main);
}
}
布局文件
welcome_alpha.xml
<?xml version="1.0" encoding="utf-8"?>
<set xmlns:android="http://schemas.android.com/apk/res/android"
android:interpolator="@android:anim/accelerate_interpolator">
<alpha
android:fromAlpha="0.0"
android:toAlpha="1.0"
android:duration="2000"
/>
<alpha
android:fromAlpha="1.0"
android:toAlpha="0.0"
android:startOffset="3000"
android:duration="3000"
/>
</set>
welcome.xml
<?xml version="1.0" encoding="utf-8"?>
<LinearLayout xmlns:android="http://schemas.android.com/apk/res/android"
android:layout_width="fill_parent"
android:layout_height="fill_parent"
android:orientation="vertical"
android:gravity="center_vertical|center_horizontal">
<ImageView
android:id="@+id/welcome_image_view"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:src="@drawable/welcome"
/>
</LinearLayout>
main.xml
<?xml version="1.0" encoding="utf-8"?>
<LinearLayout xmlns:android="http://schemas.android.com/apk/res/android"
android:layout_width="fill_parent"
android:layout_height="fill_parent"
android:orientation="vertical" >
<TextView
android:layout_width="fill_parent"
android:layout_height="wrap_content"
android:text="软件主界面" />
</LinearLayout>
- android欢迎界面动画加载
- android欢迎界面动画收集
- Android 欢迎界面淡出动画效果(Animation)
- Android欢迎界面动画与跳转
- Android Animation 动画做欢迎界面
- Android应用的欢迎界面动画实现
- 欢迎界面动画
- Android实现进入界面时,加载欢迎界面
- 【Android界面实现】使用View Animation实现动画加载界面
- 用Animation动画实现Android应用的欢迎界面
- android欢迎界面实现 ,线程实现和动画实现
- Android之带渐变动画的欢迎界面
- Android之带渐变动画的欢迎界面
- Android 欢迎界面的实现(带透明度动画)
- android 使用webView加载欢迎界面的个人实现思路,实现欢迎界面不断在改变
- 欢迎界面的动画效果
- android 使用View Animation实现动画加载界面
- android 使用View Animation实现动画加载界面
- Design Pattern:Abstract Factory
- linux驱动平台相关资源
- 黑马程序员_对象在内存中创建过程
- 用于快速编译简单的C语言程序的shell脚本
- 新手问问
- android欢迎界面动画加载
- 编程之美-----高效率地安排见面会
- iOS之线程间通信
- Ubuntu(Linux)使用Eclipse搭建C/C++编译环境
- SQL SERVER中架构的理解
- How to store CGRect values in NSMutableArray?
- RC编译选项
- java BufferedReader和InputStreamReader的区别
- C算法精解---链表(2)