<?xml version="1.0" encoding="utf-8"?> <manifest xmlns:android="http://schemas.android.com/apk/res/android" package="com.wbh.hoge.crmapp"> <application android:name=".base.SdCrmApplication" android:allowBackup="true" android:icon="@drawable/ic_icon" android:label="@string/app_name" android:largeHeap="true" android:theme="@android:style/Theme.Light.NoTitleBar"> <activity android:name=".activity.main.MainActivity" > <!--设置主窗体--> <intent-filter> <action android:name="android.intent.action.MAIN" /> <category android:name="android.intent.category.LAUNCHER" /> </intent-filter> </activity> <activity android:name=".activity.login.LoginActivity"></activity> </application> </manifest>
1、上面是设置主窗体;
2、调用其他窗体
@SuppressLint("ShowToast") public class MainActivity extends Activity { @Override protected void onCreate(Bundle savedInstanceState) { super.onCreate(savedInstanceState); setContentView(R.layout.activity_main); init(); } @Override protected void onNewIntent(Intent intent) { //super.onNewIntent(intent); init(); } public void init(){ startActivity(new Intent(getApplicationContext(),LoginActivity.class)); } }
3、Gradle.builde 这个好像还不怎么清楚;
// 声明是Android程序 apply plugin: 'com.android.application' android { compileSdkVersion 23 buildToolsVersion "23.0.2" defaultConfig { applicationId "com.wbh.hoge.crmapp" minSdkVersion 21 targetSdkVersion 23 versionCode 1 versionName "1.0" } //移除lint检查的error lintOptions { abortOnError false } buildTypes { release { // 是否进行混淆 minifyEnabled false // 混淆文件的位置 proguardFiles getDefaultProguardFile('proguard-android.txt'), 'proguard-rules.pro' } } } dependencies { // 编译libs目录下的所有jar包 compile fileTree(dir: 'libs', include: ['*.jar']) testCompile 'junit:junit:4.12' compile 'com.android.support:appcompat-v7:23.1.1' compile 'com.android.support:support-v4:23.1.1' compile 'com.umeng:fb:5.4.0' compile 'com.jiechic.library:xUtils:2.6.14' } repositories { jcenter() maven { url "https://raw.githubusercontent.com/umeng/mvn-repo-umeng/master/repository" } }