36 APP常用功能设计
36.1启动页面设计
启动页面的图片设计成动态配置的,可以显示不同的广告。
当服务器更新了显示的图片后,APP下载并保存到本地,下次启动的时候显示新图片。
在启动APP的时候,因为要花费时间解析布局文件和加载资源,导致会出现短暂的白屏现象。
解决方案如下:
//先定义style
<stylename="AppSplash"
parent="android:style/Theme.Black.NoTitleBar.Fullscreen">
<itemname="android:windowBackground">@drawable/img_launcher</item>
</style>
//设置启动Activity的theme为之前定义的style
<activity
android:name=".ui.MainActivity"
android:noHistory="true"
android:screenOrientation="portrait"
android:theme="@style/AppSplash">
<intent-filter>
<actionandroid:name="android.intent.action.MAIN" />
<categoryandroid:name="android.intent.category.DEFAULT" />