Android實(shí)現(xiàn)歡迎頁快速啟動(dòng)的方法
Android 歡迎頁快速啟動(dòng)
大家應(yīng)該都知道,在默認(rèn)情況下,Android App在點(diǎn)擊App logo到App完全啟動(dòng)這之間會(huì)有一段時(shí)間空白期。那么如何做到在用戶點(diǎn)擊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è)置一個(gè)視圖,這個(gè)視圖來自于主題,在主題中為你的SplashActivity設(shè)置UI就足夠了。
總結(jié)
以上就是這篇文章的全部?jī)?nèi)容了,希望本文的內(nèi)容對(duì)大家的學(xué)習(xí)或者工作能帶來一定的幫助,如果有疑問大家可以留言交流,謝謝大家對(duì)腳本之家的支持。
相關(guān)文章
Android端實(shí)現(xiàn)單點(diǎn)登錄的方法詳解
所謂單點(diǎn)登錄就是指的同一個(gè)賬戶(id)不能在一個(gè)以上的設(shè)備上登錄對(duì)應(yīng)的用戶系統(tǒng)(排除web端和移動(dòng)端可以同時(shí)登錄的情況),例如:用戶m在A設(shè)備登錄并保持登錄狀態(tài),然后又在B設(shè)備登錄,此時(shí)A應(yīng)該要強(qiáng)制下線,m無法在A設(shè)備上繼續(xù)執(zhí)行用戶相關(guān)的操作,下面來一起看看吧。2016-11-11
淺談AnDroidDraw+DroidDraw實(shí)現(xiàn)Android程序UI設(shè)計(jì)的分析說明
本篇文章是對(duì)AnDroidDraw+DroidDraw實(shí)現(xiàn)Android程序UI設(shè)計(jì)進(jìn)行了詳細(xì)的分析介紹,需要的朋友參考下2013-05-05
Android App中使用LinearLayout進(jìn)行居中布局的實(shí)例講解
這篇文章主要介紹了Android App中使用LinearLayout進(jìn)行居中布局的實(shí)例講解,文中分別介紹了水平居中和垂直居中的相關(guān)線性布局,需要的朋友可以參考下2016-04-04
Android自定義帶圓點(diǎn)的半圓形進(jìn)度條
這篇文章主要為大家詳細(xì)介紹了Android自定義帶圓點(diǎn)的半圓形進(jìn)度條,具有一定的參考價(jià)值,感興趣的小伙伴們可以參考一下2018-12-12
Android ToggleButton 詳解及實(shí)例代碼
這篇文章主要介紹了Android ToggleButton 詳解及實(shí)例代碼的相關(guān)資料,需要的朋友可以參考下2017-02-02
Android使用多線程進(jìn)行網(wǎng)絡(luò)聊天室通信
這篇文章主要為大家詳細(xì)介紹了Android使用多線程進(jìn)行網(wǎng)絡(luò)聊天室通信,具有一定的參考價(jià)值,感興趣的小伙伴們可以參考一下2017-10-10
Android 判斷某個(gè)Activity 是否在前臺(tái)運(yùn)行的實(shí)例
下面小編就為大家分享一篇Android 判斷某個(gè)Activity 是否在前臺(tái)運(yùn)行的實(shí)例,具有很好的參考價(jià)值,希望對(duì)大家有所幫助。一起跟隨小編過來看看吧2018-03-03
ListView的View回收引起的checkbox狀態(tài)改變監(jiān)聽等問題解決方案
之前講到了自定義Adapter傳遞給ListView時(shí),因?yàn)長(zhǎng)istView的View回收,需要注意當(dāng)ListView列表項(xiàng)中包含有帶有狀態(tài)標(biāo)識(shí)控件的問題,感興趣的朋友可以祥看本文,或許會(huì)有意外的收獲哦2013-01-01

