标签:
方法1:在主文件中写入
1 <span style="font-size:14px;"> // 取消标题 2 this.requestWindowFeature(Window.FEATURE_NO_TITLE); 3 // 取消状态栏 4 this.getWindow().setFlags(WindowManager.LayoutParams.FLAG_FULLSCREEN, 5 WindowManager.LayoutParams.FLAG_FULLSCREEN); </span>
方法2:在AndroidManifest.xml配置文件中修改显示的状态
1 <span style="font-size:14px;"> <activity android:name="com.example.walkerlogin1.WelcomeActivity" 2 android:label="@string/app_name" 3 android:theme="@android:style/Theme.Black.NoTitleBar.Fullscreen" 4 > 5 6 </activity></span>
具体实现代码
1 package com.example.walkerlogin1; 2 3 4 import android.app.Activity; 5 import android.content.Intent; 6 import android.os.Bundle; 7 import android.view.animation.AlphaAnimation; 8 import android.view.animation.Animation; 9 import android.view.animation.Animation.AnimationListener; 10 import android.widget.RelativeLayout; 11 12 13 public class WelcomeActivity extends Activity { 14 15 protected void onCreate(Bundle savedInstanceState) { 16 super.onCreate(savedInstanceState); 17 // 取消标题 18 this.requestWindowFeature(Window.FEATURE_NO_TITLE); 19 // 取消状态栏 20 this.getWindow().setFlags(WindowManager.LayoutParams.FLAG_FULLSCREEN, 21 WindowManager.LayoutParams.FLAG_FULLSCREEN); 22 setContentView(R.layout.activity_welcome); 23 RelativeLayout layoutWelcome=(RelativeLayout) findViewById(R.id.activity_welcome); 24 AlphaAnimation alphaAnimation=new AlphaAnimation(0.1f,1.0f); 25 alphaAnimation.setDuration(3000); 26 layoutWelcome.startAnimation(alphaAnimation); 27 alphaAnimation.setAnimationListener(new AnimationListener() { 28 public void onAnimationStart(Animation animation) { 29 30 } 31 32 public void onAnimationRepeat(Animation animation) { 33 34 } 35 36 public void onAnimationEnd(Animation animation) { 37 System.out.println("你好"); 38 Intent intent=new Intent(WelcomeActivity.this,GuideActivity.class); 39 startActivity(intent); 40 } 41 }); 42 } 43 }
修改配置文件:
1 <?xml version="1.0" encoding="utf-8"?> 2 <manifest xmlns:android="http://schemas.android.com/apk/res/android" 3 package="com.example.walkerlogin1" 4 android:versionCode="1" 5 android:versionName="1.0" > 6 7 <uses-sdk 8 android:minSdkVersion="8" 9 android:targetSdkVersion="17" /> 10 11 <application 12 android:allowBackup="true" 13 android:icon="@drawable/ic_launcher" 14 android:label="@string/app_name" 15 android:theme="@style/AppTheme" > 16 17 <activity android:name="com.example.walkerlogin1.MainActivity" 18 android:label="@string/app_name"></activity> 19 <activity android:name="com.example.walkerlogin1.WelcomeActivity" 20 android:label="@string/app_name" 21 android:theme="@android:style/Theme.Black.NoTitleBar.Fullscreen" 22 > 23 <intent-filter> 24 <action android:name="android.intent.action.MAIN" />//取消标题栏 25 26 <category android:name="android.intent.category.LAUNCHER" /> 27 </intent-filter> 28 29 </activity> 30 31 </application> 32 33 </manifest>
UI布局 activity_welcome.xml
1 <RelativeLayout xmlns:android="http://schemas.android.com/apk/res/android" 2 xmlns:tools="http://schemas.android.com/tools" 3 android:layout_width="match_parent" 4 android:layout_height="match_parent" 5 android:background="@drawable/welcome_bg" 6 tools:context=".WelcomeActivity" 7 android:id="@+id/activity_welcome"> 8 9 </RelativeLayout>
标签:
原文地址:http://www.cnblogs.com/yfw07/p/5600278.html