Android之七 闪屏的实现

可以有两种方法实现::在主文件中写入
<span style="font-size:14px;">  // 取消标题          this.requestWindowFeature(Window.FEATURE_NO_TITLE);          // 取消状态栏          this.getWindow().setFlags(WindowManager.LayoutParams.FLAG_FULLSCREEN,                  WindowManager.LayoutParams.FLAG_FULLSCREEN);  </span>

二:可以在AndroidManifest.xml配置文件中修改显示的状态在application应用程序中加入
<span style="font-size:14px;"> <activity  android:name="com.example.walkerlogin1.WelcomeActivity"            android:label="@string/app_name"            android:theme="@android:style/Theme.Black.NoTitleBar.Fullscreen"            >                </activity></span>

下面是具体 的实现代码:
package com.example.walkerlogin1;import android.app.Activity;import android.content.Intent;import android.os.Bundle;import android.view.animation.AlphaAnimation;import android.view.animation.Animation;import android.view.animation.Animation.AnimationListener;import android.widget.RelativeLayout;public class WelcomeActivity extends Activity {protected void onCreate(Bundle savedInstanceState) {   super.onCreate(savedInstanceState);               // 取消标题               this.requestWindowFeature(Window.FEATURE_NO_TITLE);          // 取消状态栏             this.getWindow().setFlags(WindowManager.LayoutParams.FLAG_FULLSCREEN,                  WindowManager.LayoutParams.FLAG_FULLSCREEN);  setContentView(R.layout.activity_welcome);  RelativeLayout layoutWelcome=(RelativeLayout) findViewById(R.id.activity_welcome);  AlphaAnimation alphaAnimation=new AlphaAnimation(0.1f,1.0f);   alphaAnimation.setDuration(3000);   layoutWelcome.startAnimation(alphaAnimation);  alphaAnimation.setAnimationListener(new AnimationListener() {    public void onAnimationStart(Animation animation) { }      public void onAnimationRepeat(Animation animation) { }     public void onAnimationEnd(Animation animation) { System.out.println("你好");Intent  intent=new Intent(WelcomeActivity.this,GuideActivity.class);     startActivity(intent);  } });  }}
也可以在配置文件中修改
<?xml version="1.0" encoding="utf-8"?><manifest xmlns:android="http://schemas.android.com/apk/res/android"    package="com.example.walkerlogin1"    android:versionCode="1"    android:versionName="1.0" >    <uses-sdk        android:minSdkVersion="8"        android:targetSdkVersion="17" />    <application        android:allowBackup="true"        android:icon="@drawable/ic_launcher"        android:label="@string/app_name"        android:theme="@style/AppTheme" >              <activity  android:name="com.example.walkerlogin1.MainActivity"            android:label="@string/app_name"></activity>         <activity  android:name="com.example.walkerlogin1.WelcomeActivity"            android:label="@string/app_name"            android:theme="@android:style/Theme.Black.NoTitleBar.Fullscreen"            >             <intent-filter>                <action android:name="android.intent.action.MAIN" />//取消标题栏                <category android:name="android.intent.category.LAUNCHER" />            </intent-filter>                 </activity>             </application></manifest>
UI布局代码:activity_welcome.xml
<RelativeLayout 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:background="@drawable/welcome_bg"    tools:context=".WelcomeActivity"     android:id="@+id/activity_welcome"></RelativeLayout>
最终显示界面:Android之七 闪屏的实现_第1张图片



更多相关文章

  1. Android移动操作系统源代码
  2. Android Studio系列(二)使用Android Studio开发/调试整个android系
  3. Android开发常用代码片段(三)
  4. Android 性能优化之Java(Android)代码优化 (三)
  5. Android常用代码之普通及系统权限静默安装APK
  6. android中删除启动界面的时候弹出的显示标题栏
  7. 设置无标题&设置不显示状态栏
  8. android 常用代码
  9. 常用的android权限配置和常用工具代码

随机推荐

  1. 常见的事件
  2. 利用函数对对象的处理
  3. 如何用EOS和OpenShift部署一个BaaS系统
  4. promise间隔时间添加dom
  5. Python类型转换
  6. 回调函数的学习
  7. 插入排序(直接插入)
  8. 关于获得当前的index的方法
  9. echart(2),模拟数据导入篇
  10. Matlab仿真模拟的4个非常基础!!实例(附源码)