2015-05-06 15 views
-1

我使用了9 Patch generator online.但是当我创建资源时,它创建的HDPI资源为540x960像素。据我所知,HDPI资源通常是480x800像素。我如何正确使用资源。如何使用540x 960 HDPI 9用于480x800分辨率的补丁图像

  1. 有没有办法在HDPI中使用540x960像素的图像为480x800像素 也?
  2. 如何创建一个480x800像素的9补丁资源,以便将其用于HDPI 分辨率。还有其他工具吗?

使用的代码: <RelativeLayout 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" tools:context=".Test" > <ImageView android:layout_width="fill_parent" android:layout_height="fill_parent" android:src="@drawable/tutorial" /> </RelativeLayout>

,如果你看到了双方未填充的图像样本。我已验证图像是否正确修补。

+1

你可能**误用了你的9个补丁。他们不必像屏幕一样大。他们的目的是**伸展**以适应他们的容器大小。 –

+0

@DerGolem 我已经使用了下面的代码。 \t Pranavzz

回答

0

这是你的错误:

android:src="@drawable/tutorial" 

它必须是

android:background="@drawable/tutorial" 

被拉长

而且记住,扩展名必须是.9.png,不.png


旁注:fill_parent一直弃用(因为API等级8级)。
请使用match_parent代替。