修改:
1.MainActivityWelcome.class文件内容
2.AndroidManifest.xml文件内容,注册主程序
package com.cn.seesun2012.androidstyle;
import Android.app.Activity;
import android.content.Intent;
import android.content.pm.PackageInfo;
import android.content.pm.PackageManager;
import android.content.pm.PackageManager.NameNotFoundException;
import android.os.Bundle;
import android.os.Handler;
import android.util.Log;
import android.view.Window;
import android.view.WindowManager;
import android.widget.TextView;
public class MainActivityWelcome extends Activity {
//修改如下几点:
//1.修改所有的当前类名。此处当前类名为"MainActivityWelcome",改为你自己的当前的类名:"***.class"(可对照修改);
//2.修改需要加载的xml界面名,此处当前加载的是"activity_welcome",改为你自己的当前的xml文件:"***.xml"(可对照修改);
//3.在加载的xml文件了添加所需的图片imageView控件,将已定义的"imageView"id复制到当前类,在修改3处修改;
//4.不知道当前类名的请往上翻
@Override
protected void onCreate(Bundle savedInstanceState) {
super.onCreate(savedInstanceState);
//隐藏默认标题栏
requestWindowFeature(Window.FEATURE_NO_TITLE);
//去掉信息栏
this.getWindow().setFlags(WindowManager.LayoutParams.FLAG_FULLSCREEN,
WindowManager.LayoutParams.FLAG_FULLSCREEN);
//需要加载的xml界面
setContentView(R.layout.activity_welcome);
//修改"activity_welcome"为你当前的res→layout→需要加载的界面
PackageManager pm = getPackageManager();
try {
PackageInfo pi = pm.getPackageInfo("com.lyt.android", 0);
//调用TextView
TextView versionNumber = (TextView) findViewById(R.id.imageView1);
//"imageView1"需要加载的imageView控件ID名(这个是你自定义的id名)
versionNumber.setText("Version " + pi.versionName);
}
catch (NameNotFoundException e) {
e.printStackTrace();
}
//
new Handler().postDelayed(new Runnable() {
//封装的run()方法,用在
@Override
public void run() {
//页面跳转
Intent intent = new Intent(MainActivityWelcome.this,MainActivity.class);
//保存跳转信息
startActivity(intent);
//进入第二个界面前销毁当前的活动,"finish()"销毁活动
MainActivityWelcome.this.finish();
}
//这里的数字为延时时长
}, 2500);
}
}
1."AndroidManifest.xml"文件内容
2."AndroidManifest.xml"文件内容
3."AndroidManifest.xml"文件内容
<?xml version="1.0" encoding="utf-8"?>
<manifest xmlns:android="http://schemas.android.com/apk/res/android"
package="com.cn.seesun2012.androidstyle"
android:versionCode="1"
android:versionName="1.0" >
<uses-sdk
android:minSdkVersion="14"
android:targetSdkVersion="19" />
<!-- ------在这个里面注册主程序------- -->
<application
android:allowBackup="true"
android:icon="@drawable/ic_launcher"
android:label="@string/app_name"
android:theme="@style/AppTheme" >
<activity
android:name=".MainActivityWelcome"
android:label="安卓Style" >
<intent-filter>
<action android:name="android.intent.action.MAIN" />
<category android:name="android.intent.category.LAUNCHER" />
</intent-filter>
</activity>
<!-- 修改的地方在这里,注册主程序,这里是"MainActivityWelcome" -->
<!-- 这里是第二个第三个以及跟多...界面的注册标签 -->
<activity android:name=".MainActivity" ></activity>
<activity android:name=".MainActivitySecond" ></activity>
<activity android:name=".MainActivityZhuce" ></activity>
<!-- 这里是第二个第三个以及跟多...界面的注册标签 -->
</application>
<!-- 在这个里面注册主程序 -->
</manifest>
注:以上内容仅提供参考和交流,请勿用于商业用途,如有侵权联系本人删除!
持续更新中…
如有对思路不清晰或有更好的解决思路,欢迎与本人交流,QQ群:273557553,个人微信:
你遇到的问题是小编创作灵感的来源!