【发布时间】:2014-05-23 03:59:45
【问题描述】:
昨天我拿到了 Galaxy Nexus,令我惊讶的是,我的应用程序的背景根本没有显示。一切都在那里,应用程序本身运行良好,只是没有背景,因为我禁用了 Android,所以出现了背景涂抹。
作为测试设备,我可以访问 Galaxy S4、摩托罗拉 G 和 LG 平板电脑,在所有设备上我的应用都可以完美运行,并且显示背景。我在模拟器上测试了几种不同分辨率的设备,它们也能完美运行。
现在我不区分不同的布局,这就是我以后想做的。我单独的drawable-xxxx文件夹都是空的,一切都在drawable文件夹中。
我在 xml 文件中这样设置背景:
<LinearLayout xmlns:android="http://schemas.android.com/apk/res/android"
android:layout_width="match_parent"
android:layout_height="match_parent"
android:background="@drawable/ss0_background"
android:gravity="fill_horizontal"
android:orientation="vertical" >
这是我在 styles.xml 文件中的自定义主题:
<style name="noAnimTheme" parent="android:Theme.NoTitleBar.Fullscreen">
<item name="android:windowAnimationStyle">@null</item>
<item name="android:windowBackground">@null</item>
<item name="android:soundEffectsEnabled">false</item>
</style>
在这里我禁用了 androids 自己的背景(在某处读到,如果你有自己的背景,这样会更好)
这是我使用自定义主题的清单文件的一部分:
<application
android:allowBackup="true"
android:icon="@drawable/ic_launcher"
android:label="@string/app_name"
android:theme="@style/noAnimTheme"
就像我说的,我在模拟器中从未遇到过这样的问题,即使我模拟 Galaxy Nexus,我什至不知道从哪里开始调试这个问题。
提前感谢您的帮助!
【问题讨论】: