我正在将现有的 Android 应用程序以及片段 API 和兼容性库移植到 honeycomb。我使用相同的布局,但将其加载到片段中。背景是 9 块图像,但现在仅覆盖屏幕的左上四分之一。背景的其余部分是白色的。如果我将背景更改为十六进制颜色,它会覆盖整个屏幕。在切换到fragment之前从未发生过这种情况,而且布局也没有改变。我对 Android 有点陌生,对 Fragments 也很陌生,所以我不确定我是否遗漏了一些东西。该问题似乎与 9patch 映像有关,但我对 Android 的了解还不够,无法肯定地说。
我的布局如下所示:
<LinearLayout
xmlns:android="http://schemas.android.com/apk/res/android"
android:orientation="vertical"
android:layout_width="fill_parent"
android:layout_height="fill_parent"
android:background="@drawable/splash_background">
Something that I've found helps is to re-do your 9patch images. They have areas of padding defined by the parts that you have designated as non-content areas.
I found the solution was to make sure the content area is defined across the whole image, and to make sure the stretchable area is defined for large portions of it - especially if your nine patch image is large compared with your screen.
See the 9 patch image below. The content areas are highlighted in red:
希望这有帮助。
本文内容由网友自发贡献,版权归原作者所有,本站不承担相应法律责任。如您发现有涉嫌抄袭侵权的内容,请联系:hwhale#tublm.com(使用前将#替换为@)