2013-10-08 55 views
0

我試圖設置爲在drawable文件夾中設置此圖片soccer_field。當我查看「圖形佈局」它顯示的背景,但是當我在我的設備上運行它,它不是..設置圖片作爲Android的活動的背景

<LinearLayout xmlns:android="http://schemas.android.com/apk/res/android" 
xmlns:tools="http://schemas.android.com/tools" 
android:layout_width="match_parent" 
android:layout_height="match_parent" 
android:background="@drawable/soccer_field" 
android:orientation="horizontal"> 
</LinearLayout> 

爲什麼會出現這種情況,如何解決呢?

回答

1

唯一的區別可能是模擬器和您的設備之間屏幕分辨率不同。因此,也許您的設備正在尋找其他可繪製文件夾,如drawable-xhdpi,並且無法在適合設備分辨率的任何其他可繪製文件夾中找到drawable。

Here you can find more about this

+0

我試圖把我的照片中的所有文件夾繪製的,它仍然沒有工作! –

+0

如果在'drawable - ?? dpi'文件夾中找不到它,默認情況下它會查找'drawable',這是OP所說的位置。 – Geobits

+0

好,很難。 'soccer_field'是一個PNG文件?你在代碼中使用佈局做些什麼?如果設備上顯示任何內容,您是否可以嘗試使用虛擬文本添加文本視圖? – jboi