Skip to content

Commit

Permalink
添加启动画面
Browse files Browse the repository at this point in the history
  • Loading branch information
iHaPBoy committed Jun 11, 2016
1 parent e5d1a84 commit adc0383
Show file tree
Hide file tree
Showing 5 changed files with 67 additions and 10 deletions.
10 changes: 7 additions & 3 deletions app/src/main/AndroidManifest.xml
Expand Up @@ -15,9 +15,7 @@
android:theme="@style/AppTheme"
tools:replace="android:icon">
<activity
android:name=".activity.MainActivity"
android:label="@string/app_name"
android:launchMode="singleTask"
android:name=".activity.SplashScreenActivity"
android:screenOrientation="portrait"
android:theme="@style/AppTheme.NoActionBar">
<intent-filter>
Expand All @@ -26,6 +24,12 @@
<category android:name="android.intent.category.LAUNCHER" />
</intent-filter>
</activity>
<activity
android:name=".activity.MainActivity"
android:label="@string/app_name"
android:launchMode="singleTask"
android:screenOrientation="portrait"
android:theme="@style/AppTheme.NoActionBar"></activity>
<activity
android:name=".activity.BookInfoActivity"
android:screenOrientation="portrait" />
Expand Down
@@ -0,0 +1,28 @@
package me.icxd.bookshelve.activity;

import android.content.Intent;
import android.os.Handler;
import android.support.v7.app.AppCompatActivity;
import android.os.Bundle;
import android.view.WindowManager;

import me.icxd.bookshelve.R;

public class SplashScreenActivity extends AppCompatActivity {

@Override
protected void onCreate(Bundle savedInstanceState) {
super.onCreate(savedInstanceState);
setContentView(R.layout.activity_splash_screen);

getWindow().setFlags(WindowManager.LayoutParams. FLAG_FULLSCREEN ,WindowManager.LayoutParams. FLAG_FULLSCREEN);

new Handler().postDelayed(new Runnable() {
public void run() {
Intent mainIntent = new Intent(SplashScreenActivity.this, MainActivity.class);
SplashScreenActivity.this.startActivity(mainIntent);
SplashScreenActivity.this.finish();
}
}, 2000);
}
}
24 changes: 24 additions & 0 deletions app/src/main/res/layout/activity_splash_screen.xml
@@ -0,0 +1,24 @@
<?xml version="1.0" encoding="utf-8"?>
<LinearLayout 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="@color/colorPrimary"
android:gravity="center"
android:orientation="vertical"
tools:context="me.icxd.bookshelve.activity.SplashScreenActivity">

<ImageView
android:layout_width="80dp"
android:layout_height="80dp"
android:src="@drawable/ic_import_contacts_white_48dp" />

<TextView
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:layout_marginTop="20dp"
android:text="书柜"
android:textColor="#FFFFFF"
android:textSize="24sp" />

</LinearLayout>
13 changes: 7 additions & 6 deletions app/src/main/res/layout/nav_header_main.xml
Expand Up @@ -22,13 +22,14 @@
android:layout_width="match_parent"
android:layout_height="wrap_content"
android:paddingTop="@dimen/nav_header_vertical_spacing"
android:text="HaPBoy"
android:text="我的书柜"
android:textSize="18sp"
android:textAppearance="@style/TextAppearance.AppCompat.Body1" />

<TextView
android:id="@+id/textView"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:text="ihapboy@gmail.com" />
<!--<TextView-->
<!--android:id="@+id/textView"-->
<!--android:layout_width="wrap_content"-->
<!--android:layout_height="wrap_content"-->
<!--android:text="ihapboy@gmail.com" />-->

</LinearLayout>
2 changes: 1 addition & 1 deletion build.gradle
Expand Up @@ -5,7 +5,7 @@ buildscript {
jcenter()
}
dependencies {
classpath 'com.android.tools.build:gradle:2.1.0'
classpath 'com.android.tools.build:gradle:2.1.2'

// NOTE: Do not place your application dependencies here; they belong
// in the individual module build.gradle files
Expand Down

0 comments on commit adc0383

Please sign in to comment.