Android默认加载页设置
2015-12-24 13:46
393 查看
默认的情况下,程序启动时,会有一个黑屏的时期,原因是,首个activity会加载一些数据,比如初始化列表数据等。具体步骤如下:
1./res/values/styles.xml 在 Theme 中,添加一个 android:windowBackgrounds 属性,设置需要的图片。
2.在 AndroidManifest.xml 中设置Theme到首个启动的Activity下。
3.添加 /res/drawable-port/loading.png (若是横屏的启动画面,请放于 /res/drawable-land/loading.png )。
4.完成
参考代码:
来源: /article/11104239.html
1./res/values/styles.xml 在 Theme 中,添加一个 android:windowBackgrounds 属性,设置需要的图片。
2.在 AndroidManifest.xml 中设置Theme到首个启动的Activity下。
3.添加 /res/drawable-port/loading.png (若是横屏的启动画面,请放于 /res/drawable-land/loading.png )。
4.完成
参考代码:
<style name="MyTheme.NoTitleBar.CustomBackground" parent="@android:Theme.Black"> <item name="android:windowBackground">@drawable/loading</item> <item name="android:windowNoTitle">true</item> <item name="android:windowFullscreen">true</item> <item name="android:windowContentOverlay">@null</item> </style>
<application android:icon="@drawable/icon" android:label="@string/app_name" android:debuggable="true"> <activity android:label="@string/app_name" android:theme="@style/MyTheme.NoTitleBar.CustomBackground" android:configchanges="keyboardHidden|navigation|orientation" android:screenorientation="portrait"> <intent-filter> <action android:name="android.intent.action.MAIN"/> <category android:name="android.intent.category.LAUNCHER"/> </intent-filter> </activity> </application>
来源: /article/11104239.html
相关文章推荐
- Android ANR 类型
- Android EventBus源代码解析 带你深入理解EventBus
- 使用新版Android Studio检测内存泄露和性能
- 使用新版Android Studio检测内存泄露和性能
- Android - Activity,A,B,C跳过B直接返回A
- Android给Button设置drawableRigh 在代码中动态改变
- 6.Android之switch和togglebutton按钮学习
- Android中设定EditText的输入长度
- Android Studio 多渠道打包
- android中ListView多次重复执行getView的问题
- Android 内存泄漏分析工具LeakCanary
- 360项目总结01
- Activity之间传递Bitmap
- 《Android群英传》读书笔记(11)第十章:Android性能优化
- 关于Android 页面间或者页面内 的通信
- Android NDK环境测试
- Android Loader详解
- android高德地图用invisiable和visiable切换时,出现闪烁的解决方案
- android studio快捷键
- Android 异步加载图片,使用LruCache和SD卡或手机缓存,效果非常的流畅