2012-04-15 83 views
0

我試圖爲Android開發一個應用程序,但我遇到了一些問題。我有一個主要的RelativeLayout,它有一個很好的背景圖像。當我通過AVD(over eclipse)運行它時,它工作並且看起來很好,但是當我嘗試在Galaxy Nexus手機上測試它時,背景是純黑的。我該如何解決這個問題?背景在運行時繪製黑色

主要佈局

<RelativeLayout xmlns:android="http://schemas.android.com/apk/res/android" 
android:id="@+id/GPRelativeLayout" 
android:layout_width="fill_parent" 
android:layout_height="fill_parent" 
android:background="@drawable/gempouchbg" 
android:orientation="vertical"> 

它與一些頭佈局合併。

<include 
    android:id="@+id/headerMerge" 
    android:layout_width="wrap_content" 
    android:layout_height="wrap_content" 
    android:layout_alignParentLeft="true" 
    android:layout_alignParentTop="true" 
    android:layout_marginTop="45dp" 
    layout="@layout/header" /> 

任何人都可以幫我嗎? :/

回答

0

我已經解決了這個問題,背景圖片尺寸太大了,我需要將它裁剪到640x640,它解決了我的問題。希望它對任何人都有幫助。

0

由於您正在使用圖像來設置relativelayout的背景,因此它在所有情況下都必須看起來相同。

如果您對背景不滿意,那麼您必須更改您的案例中的圖片並嘗試。

將您的圖像放入可繪製文件夾中並嘗試一次。

+0

背景圖像根本沒有顯示,而是我得到一個黑色的背景。那就是問題所在。 – Diabolic 2012-04-15 09:33:13