main activity

  1. package com.splash.screen;
  2.  
  3. import android.app.Activity;
  4. import android.content.Intent;
  5. import android.content.res.Configuration;
  6. import android.os.Bundle;
  7. import android.os.Handler;
  8. import android.util.Log;
  9. import android.view.Window;
  10. import android.view.WindowManager;
  11. import android.view.animation.AlphaAnimation;
  12. import android.view.animation.Animation;
  13. import android.widget.ImageView;
  14.  
  15. import com.newbravo.sg.Game;
  16. import com.newbravo.sg.R;
  17.  
  18. /**
  19. * Created by lyhd on 2016/8/2.
  20. */
  21. public class LogoSplashActivity extends Activity {
  22.  
  23. private LogoSplashActivity mySplashActivity;
  24. @Override
  25. protected void onCreate(Bundle savedInstanceState) {
  26. super.onCreate(savedInstanceState);
  27. Log.d("LogoSplashActivity","onCreate");
  28. mySplashActivity = this;
  29. // 取消标题
  30. this.requestWindowFeature(Window.FEATURE_NO_TITLE);
  31. // 取消状态栏
  32. this.getWindow().setFlags(WindowManager.LayoutParams.FLAG_FULLSCREEN,
  33. WindowManager.LayoutParams.FLAG_FULLSCREEN);
  34.  
  35. setContentView(R.layout.logo_splash);
  36.  
  37. Log.d("cgz_android: ",this.getExternalFilesDir(null).toString());
  38.  
  39. //第一种闪屏方式
  40. // 闪屏的核心代码
  41. // new Handler().postDelayed(new Runnable() {
  42. // @Override
  43. // public void run() {
  44. // Intent intent = new Intent(LogoSplashActivity.this,
  45. // Game.class); // 从启动动画ui跳转到主ui
  46. // startActivity(intent);
  47. // mySplashActivity.overridePendingTransition(R.anim.in_screen,
  48. // R.anim.out_screen);
  49. // LogoSplashActivity.this.finish(); // 结束启动动画界面
  50. //
  51. // }
  52. // }, 3000); // 启动动画持续3秒钟
  53.  
  54. //第二种方式
  55.  
  56. ImageView logoImage = (ImageView) this.findViewById(R.id.logo_splash);
  57. AlphaAnimation alphaAnimation = new AlphaAnimation(0.1f, 1.0f);
  58. alphaAnimation.setDuration(3000);
  59. logoImage.startAnimation(alphaAnimation);
  60. alphaAnimation.setAnimationListener(new Animation.AnimationListener() {
  61.  
  62. @Override
  63. public void onAnimationStart(Animation animation) {
  64.  
  65. }
  66.  
  67. @Override
  68. public void onAnimationRepeat(Animation animation) {
  69.  
  70. }
  71.  
  72. @Override
  73. public void onAnimationEnd(Animation animation) {
  74. Intent intent = new Intent();
  75. intent.setClass(LogoSplashActivity.this, Game.class);
  76. intent.setAction(Intent.ACTION_MAIN);
  77. intent.addCategory(Intent.CATEGORY_LAUNCHER);
  78. startActivity(intent);
  79. //startActivity(new Intent("com.google.app.splashy.CLEARSPLASH"));
  80. finish();
  81. }
  82. });
  83. }
  84.  
  85. @Override
  86. public void onConfigurationChanged(Configuration newConfig) {
  87. super.onConfigurationChanged(newConfig);
  88. }
  89.  
  90. @Override
  91. protected void onPause() {
  92. super.onPause();
  93.  
  94. }
  95.  
  96. @Override
  97. protected void onResume() {
  98. super.onResume();
  99.  
  100. }
  101. }

所用的1个layout

  1. <?xml version="1.0" encoding="utf-8"?>
  2. <LinearLayout xmlns:android="http://schemas.android.com/apk/res/android"
  3. android:orientation="vertical" android:layout_width="match_parent"
  4. android:layout_height="match_parent">
  5.  
  6. <ImageView
  7. android:layout_width="fill_parent"
  8. android:layout_height="fill_parent"
  9. android:layout_gravity="center"
  10. android:id="@+id/logo_splash"
  11. android:src="@drawable/logo_splash"/>
  12. </LinearLayout>

android app 闪屏的更多相关文章

  1. android 的闪屏效果

    android的闪屏效果,就是我们刚开始启动应用的时候弹出的界面或者动画,过2秒之后自动的跳转到主界面. 其实,实现这个效果很简单,使用Handler对象的postDelayed方法就可以实现.在这个 ...

  2. iphone 6plus 下app里的状态栏和界面会被放大的问题//以及设置APP闪屏页/APP图标流程

    //设置APP闪屏页/APP图标流程如下 2.6Plus界面显示变大以及APP图标变大是由于上面图片的AppIcon以及LaunchImage造成的,主要是由于找不到对应的3x图片,或者改3x图片尺寸 ...

  3. Android 实现闪屏页和右上角的倒计时跳转

    效果图: 闪屏页用到了handler和CountDownTimer类,还需配置一下Activity的主题,这里是:android:theme="@android:style/Theme.No ...

  4. 关于android应用闪屏的几种情况

    1.主菜单进入某应用闪屏: 常见是一个空的activity作为launcher属性,实际上它什么事业没干,真正干事情的是从它通过intent启动的activity. 例子: public class ...

  5. Android App 启动页(Splash)黑/白闪屏现象产生原因与解决办法(转)

    转载: Android App 启动页(Splash)黑/白闪屏现象产生原因与解决办法   首先感谢博主分享,本文作为学习记录 惊鸿一瞥 微信的启动页,相信大家都不陌生. 不知道大家有没有发现一个现象 ...

  6. 033 Android App启动的闪屏效果+新手向导(多个图片滑动效果)+ViewPager使用

    1.目标效果 App启动时,出现闪屏效果(利用动画实现). App新手使用时,会出现新手向导效果. 2.XML页面布局 (1)闪屏页面 <?xml version="1.0" ...

  7. Android app启动出现白屏闪屏

    出现白屏闪屏原因: 进入到AppStartActivity,但是未加载到布局文件,就先显示了窗口的背景,白屏就是显示的windows的背景,即所设置的theme. onCreate()中的setCon ...

  8. android开发之splash闪屏页判断是否第一次进入app代码

    package com.david.david.zhankudemo.activity; import android.app.Activity; import android.content.Con ...

  9. imx6 android 进入文件系统闪屏

    imx6进入文件系统的时候都会闪屏,应该是framebuffer未初始化,就已经打开了背光.目前解决办法,在kenel阶段关闭背光,显示android的开机动画之后(此时framebuffer已经初始 ...

随机推荐

  1. Linux 查找特定程序 whereis

    Linux 查找特定程序 whereis whereis 命令主要用于查找程序文件,并提供这个文件的二进制可执行文件.源代码文件和使用手册存放位置. 1.查找命令程序 例如,查找 touch 命令 [ ...

  2. 绝对好用Flash多文件大文件上传控件

    本实例采用的是Uploadify上传插件,.NET程序,源程序是从网上找的,但是有Bug,已经修改好,并标有部分注释.绝对好用,支持单文件.多文件上传,支持大文件上传,已经过多方面测试,保证好用. 以 ...

  3. maven中GroupID 和ArtifactID

    artifactId :unique base name of the primary artifact being generated by this project GroupID 是项目组织唯一 ...

  4. win10相机打不开,显示错误代码0xA00F4246(0x800706D9)

    有时我们在不知道什么情况下电脑便会变成这个样子,当我们以为是驱动问题的时候,或许我们可以使用下面的办法解决这个问题 方法: 1.WIN键+R打开命令端,输入regedit运行 2.进入 计算机\HKE ...

  5. 配置传统vlan间路由

    S1#SH RUN spanning-tree mode pvst ! interface FastEthernet0/1 switchport access vlan 10 switchport m ...

  6. C++ unsigned long 转化为 unsigned char*

    C++ Code 123456789101112131415161718   unsigned long lFileLen = 1000; unsigned char *ucFileLenFlag; ...

  7. # C++中对PI的引用

    #include <iostream> #include <cmath> using namespace std; int main(){ printf("%.10l ...

  8. 使用php过滤emoji表情

    /** * 过滤字符串中表情 * @param $str string 昵称 * @return string */ public function filterEmoji($str) { $str ...

  9. 从入门到自闭之Python函数初识

    函数初识 定义:def--关键字 ​ 将某个功能封装到一个空间中就是一个函数 功能: ​ 减少重复代码 函数的调用 ​ 函数名+():调用函数和接收返回值 函数的返回值 return 值 == 返回值 ...

  10. python-day31(正式学习)

    一.单机架构 应用领域: 植物大战僵尸 office 二.CS架构 应用领域: QQ 大型网络游戏 计算机发展初期用户去取数据,直接就去主机拿,从这里开始就分出了客户端和服务端. 客户端:用户安装的软 ...