国产探花免费观看_亚洲丰满少妇自慰呻吟_97日韩有码在线_资源在线日韩欧美_一区二区精品毛片,辰东完美世界有声小说,欢乐颂第一季,yy玄幻小说排行榜完本

首頁 > 系統(tǒng) > Android > 正文

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

2019-10-23 19:47:49
字體:
供稿:網(wǎng)友

Android 歡迎頁快速啟動

大家應(yīng)該都知道,在默認情況下,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/212680.html">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í)或者工作能帶來一定的幫助,如果有疑問大家可以留言交流,謝謝大家對VEVB武林網(wǎng)的支持。


注:相關(guān)教程知識閱讀請移步到Android開發(fā)頻道。
發(fā)表評論 共有條評論
用戶名: 密碼:
驗證碼: 匿名發(fā)表
主站蜘蛛池模板: 桐庐县| 东乌| 朝阳市| 光泽县| 嘉义县| 沙河市| 青龙| 石门县| 颍上县| 曲水县| 广昌县| 瑞安市| 尼木县| 错那县| 霸州市| 集安市| 宁波市| 仙桃市| 奎屯市| 沽源县| 三门县| 鸡东县| 新建县| 朝阳市| 尚义县| 亚东县| 开化县| 江城| 德保县| 安溪县| 南安市| 清原| 本溪市| 仁寿县| 青田县| 永安市| 崇文区| 西宁市| 望谟县| 贵州省| 青州市|