2012-09-09 53 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