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

首頁 > 系統 > Android > 正文

Android實現歡迎頁快速啟動的方法

2019-12-12 03:44:52
字體:
來源:轉載
供稿:網友

Android 歡迎頁快速啟動

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

設置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>

設置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中不需要設置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設置一個視圖,這個視圖來自于主題,在主題中為你的SplashActivity設置UI就足夠了。

總結

以上就是這篇文章的全部內容了,希望本文的內容對大家的學習或者工作能帶來一定的幫助,如果有疑問大家可以留言交流,謝謝大家對武林網的支持。

發表評論 共有條評論
用戶名: 密碼:
驗證碼: 匿名發表
主站蜘蛛池模板: 绥棱县| 化德县| 工布江达县| 新巴尔虎右旗| 林口县| 布拖县| 平乡县| 准格尔旗| 石城县| 五大连池市| 临颍县| 改则县| 洞口县| 建湖县| 突泉县| 淮阳县| 高阳县| 麻栗坡县| 阳江市| 方山县| 长沙县| 新晃| 崇明县| 忻城县| 诸城市| 文安县| 莱阳市| 项城市| 高州市| 高陵县| 雅江县| 洛隆县| 电白县| 建湖县| 和平区| 平南县| 黄大仙区| 中超| 重庆市| 四平市| 青神县|