Android之七 闪屏的实现
2016-05-05 14:24
531 查看
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 读取联系人数据库
- Android基础学习【历史流程重走】 ---- Android入门基础(一)
- androidstudio获取本机keystore
- Android分析破解-秒脱360加固大法
- Android主题换肤 无缝切换
- 关于AndroidStudio中包重复引用的问题(Duplicate Entry)
- IOS和android的差别
- Android json数据解析
- 学习Android Studio开发工具之Activity3(框架2)
- Android ffmpeg解码
- Token在android中的使用
- Android开发中为什么不能标记重写(@override)抽象方法(abstract)
- Android开发——DiskLruCache用法详解以及工作原理深度解析
- Unable to create Debug Bridge: Unable to start adb server
- android 实现SQLite开启事务
- Android Orm框架分析
- android开发系列之二—欢迎页面幻灯制作
- android6.0源码分析之Camera框架简介
- Android [Dex Loader] Unable to execute dex:
- Android studio补全代码和自动提示