欧美bbbwbbbw肥妇,免费乱码人妻系列日韩,一级黄片

Android實現(xiàn)歡迎頁快速啟動的方法

 更新時間:2017年02月13日 15:04:23   作者:Liu Nan  
這篇文章主要給大家介紹了Android實現(xiàn)歡迎頁快速啟動的方法,文中給出了詳細(xì)的方法介紹,對大家具有一定的參考價值,需要的朋友們可以一起來學(xué)習(xí)學(xué)習(xí)。

Android 歡迎頁快速啟動

大家應(yīng)該都知道,在默認(rèn)情況下,Android App在點擊App logo到App完全啟動這之間會有一段時間空白期。那么如何做到在用戶點擊logo圖標(biāo)之后立即打開App的界面而不是一段白屏或黑屏呢?

設(shè)置xml

在drawable下建立welcome.xml

<?xml version="1.0" encoding="utf-8"?>
<layer-list xmlns:android="http://schemas.android.com/apk/res/android">
 <!--背景色-->
 <item android:drawable="@color/white"/>
 <item>
  <!--圖片-->
  <bitmap
   android:gravity="center"
   android:src="@mipmap/welcome_page"/>
 </item>
</layer-list>

設(shè)置style

<!-- Base application theme. -->
 <style name="AppTheme" parent="Theme.AppCompat.Light.DarkActionBar">
  <!-- Customize your theme here. -->
 </style>
 <style name="WelcomeThem" parent="AppTheme">
  <item name="android:windowBackground">@drawable/welcome</item>
 </style>

清單文件中配置style

<!-- 歡迎頁 -->
  <activity
   android:name=".ui.WelcomeActivity"
   android:windowSoftInputMode="adjustNothing" android:theme="@style/WelcomeThem">
   <intent-filter>
    <action android:name="android.intent.action.MAIN"/>
    <category android:name="android.intent.category.LAUNCHER"/>
   </intent-filter>
  </activity>

Activity中不需要設(shè)置setContentView()

public class WelcomeActivity extends AppCompatActivity {
 @Override
 protected void onCreate(Bundle savedInstanceState) {
  super.onCreate(savedInstanceState);
  Intent intent = new Intent(this, MainActivity.class);
  startActivity(intent);
  finish();
 }
}

不需要為你的SplashActivity設(shè)置一個視圖,這個視圖來自于主題,在主題中為你的SplashActivity設(shè)置UI就足夠了。

總結(jié)

以上就是這篇文章的全部內(nèi)容了,希望本文的內(nèi)容對大家的學(xué)習(xí)或者工作能帶來一定的幫助,如果有疑問大家可以留言交流,謝謝大家對腳本之家的支持。

相關(guān)文章

最新評論