2012-09-09 51 views
1

我的佈局有9個補丁的背景圖片,當顯示分辨率小於圖片尺寸(800x480px)時,它可以正常工作。但是,當我在具有更大分辨率的設備(例如1280x800px)上對其進行測試時,它的佈局會被破壞。這裏有兩張照片:9-補丁背景圖片的佈局問題

The normal and broken layout

The 9-patch image

下面是相關佈局代碼:

<LinearLayout 
android:id="@+id/LinearLayout1" 
android:layout_width="match_parent" 
android:layout_height="match_parent" 
android:layout_weight="1" 
android:background="@drawable/chalkboard" 
android:gravity="top|center" 
android:orientation="vertical" > 

總而言之,9補丁不起作用當圖像尺度向上。但是,是什麼原因以及如何處理?

此致敬禮!

+0

在哪個文件夾你把這個圖像? –

+0

9個補丁位於ldpi,mdpi和hdpi中。由於OutOfMemory問題,我沒有用於xhdpi的映像。 – Namenlos

+1

問題在於你的圖片,你應該拉伸邊角而不是內容 –

回答

2

您正在拉伸框架。只是不要拉伸側面的框架。這應該做的工作: enter image description here

+0

非常感謝!現在它可以工作。 – Namenlos

+0

沒問題。很高興我能幫上忙。 – Ahmad