所以我读过关于设置窗口背景和percieved性能,并正在试图仿效该罗曼盖伊的blog post。它是这样一个简单的解决方案,不知道为什么我不能得到这个工作,但活动只是拒绝回升定向背景。安卓上推出的活动设置窗口背景
我有onListItemClick启动一个新的活动,即需要3-5秒完全加载一个ListView。当用户在等待时,我想绘制一个windowBackground,以便他们在实际准备好之前“看到”活动。这里是我的代码:
为启动的活动AndroidManifest片段:
<activity
android:name=".activity.EditorActivity"
android:screenOrientation="portrait"
android:windowBackground="@drawable/background_editor">
为EditorActivity的XML布局:
<?xml version="1.0" encoding="utf-8"?>
<FrameLayout xmlns:android="http://schemas.android.com/apk/res/android"
android:layout_width="match_parent"
android:layout_height="match_parent">
<TextView
android:id="@+id/editor"
android:layout_height="wrap_content"
android:layout_width="match_parent"
android:text="Editor" />
</FrameLayout>
最后,绘制在清单设定,background_editor.xml :
<?xml version="1.0" encoding="utf-8"?>
<bitmap xmlns:android="http://schemas.android.com/apk/res/android"
android:src="@drawable/editor_bg"
android:tileMode="repeat" />
editor_bg是位于int drawable folde中的.png文件河
最终的结果是EditorActivity被推出,而我看到的是默认的黑色背景与白色显示的“编辑器”文本(我补充说,测试的XML文件被正确加载。
我我也尝试通过android:background =“@ android:color/transparent”将FrameLayout和TextView的背景设置为透明,认为他们可能默认为黑色背景,但没有运气。
这已经很长了没几天,我敢肯定,我失去了一些东西简单...任何明显的失误,我在这儿举行?
已更新后引用链接:http://和roid-developers.blogspot.com/2009/03/window-backgrounds-ui-speed.html – 2013-05-02 20:21:47