2012-02-24 21 views
0

私のアプリの背景として使用されるres/drawableフォルダに画像を保存します。私は、私のアプリは、さまざまな密度のすべてのデバイスで動作する必要があります。合理的なアプリケーションサイズと複数の画面をサポートするために、画像を維持するための最小サイズ(ピクセル単位)。画像をピクセル単位で常にあるので、混乱をDPとないところAndroidアプリの背景画像の最小サイズ

xlarge screens are at least 960dp x 720dp 
large screens are at least 640dp x 480dp 
normal screens are at least 470dp x 320dp 
small screens are at least 426dp x 320dp 

私はフォトショップを使用します。

開発者ガイドがいることを言及しています。ところで、私はPhotoshopだけでなくAndroidでもかなり新しいです。

答えて

0

あなたがイメージに描画可能MDPIフォルダに保存320x480の大きさと、すべての小規模および大画面デバイスにおける描画可能-hdpiフォルダ

これらの両方のサイズの画像の実行中に保存480X800サイズを作成する必要があります。

媒体デバイス320x480および高密度480x800の場合。

0

固定サイズの画像をまったく使用しないでください。小さな画像をタイル張りの背景として使用するか、グラデーションとして、またはxmlリソースを使用して背景を定義します。

+0

感謝からDP ..しかし、私のイメージはcountry..soの旗のようにタイル張りの背景、グラデーションまたはXMLリソースを使用することは困難であるます。.. – ambit

+0

アプリのサイズとパフォーマンスの面で悪い考えです。 –

+0

アプリのサイズはそれほどではありません。しかし、クライアントはフラグを付けて背景を望んでいます。だから、そのオプションの多くはありません。どのようなアイデアでも、ビットマップイメージの許容サイズはどのようにして、すべてのデバイスで良好に見えるのでしょうか? – ambit

1

約9パッチimageを調べてみてください。この単一のイメージはあなたの問題を解決する可能性があります。

+0

ありがとうございます。これは良い提案です。私は9パッチの画像を使用します。しかし、もう一度、私が使用する単一の画像のサイズ(ピクセル単位)はどうでしょうか。 – ambit

2

あなたはuは、次の式を使用することができますピクセルにDPの値を変換したい場合:

int型のPX =(int型)(DP * logicalDensity + 0.5)。

ピクセルからdpを得るには、乗算ではなくピクセル値に密度を分割します。

+0

ありがとうございます。しかし、私はこの式でlogicalDensityとして何を使用すべきか分かりません。 – ambit

0

pxは1ピクセルです。フォントサイズにspを使用し、それ以外にはdipを使用する、スケールに依存しないピクセル(sp)と密度に依存しないピクセル(dip)以下のように聞こえるディップ==ここhttp://developer.android.com/guide/topics/resources/more-resources.html#Dimension

px 
Pixels - corresponds to actual pixels on the screen. 

in 
Inches - based on the physical size of the screen. 

mm 
Millimeters - based on the physical size of the screen. 

pt 
Points - 1/72 of an inch based on the physical size of the screen. 

dp 
Density-independent Pixels - an abstract unit that is based on the physical density of the screen. These units are relative to a 160 dpi screen, so one dp is one pixel on a 160 dpi screen. The ratio of dp-to-pixel will change with the screen density, but not necessarily in direct proportion. Note: The compiler accepts both "dip" and "dp", though "dp" is more consistent with "sp". 

sp 
Scale-independent Pixels - this is like the dp unit, but it is also scaled by the user's font size preference. It is recommend you use this unit when specifying font sizes, so they will be adjusted for both the screen density and user's preference.