0

I am testing my app on two devices and I am currently trying to understand how the drawables folders work:

  • Galaxy S2
  • Nexus 7

The logos are both being picked up from the hdpi folder eg: res/drawable-hdpi and I believe this is because they have the following densities.

  • Galaxy S2 - 219
  • Nexus 7 - 216

Which relate to Google's density range and are indeed hdpi:

enter image description here

If you look at the two screenshots for my app homescreen logo:

Galaxy S2

enter image description here

Nexus 7

enter image description here

You can see the logo on the Nexus 7 is a bit blurry, how can I provide a different asset for a 7" tablet if it comes from the same resource drawables folder? Do I need to set some size on the logo somewhere?

I have also read that the Nexus 7 is also categorized as tvdpi but I'm not sure I should be creating any folder for that or not.

4

2 に答える 2

3

両方のデバイスの密度がほぼ同じである場合、ロゴのサイズは画面サイズに依存していることを意味します。これは、ロゴのサイズが大きい画面ほど大きいためです。これが、ピクセル化されたように見える理由である可能性があります。したがって、最初に画像が引き伸ばされていないことを確認してください。

さまざまな画面サイズに対応する代替リソースを提供できます。たとえば、http://developer.android.com/guide/topics/resources/pproving-resources.htmlの「smallestWidth」を参照してください 。必要に応じて、ロゴ画像と同じ名前の新しい画像を追加できます。でresources/drawable-sw500dp-hdpi/。800 / 1.5 = 533なので、500を選びました。

于 2012-10-03T14:33:19.530 に答える
3

You should create a drawable-tvdpi folder and put any images that aren't rescaling cleanly enough in it. Android will try to scale down your hdpi images but that does not always look nice. I always create all images at hdpi then only recreate images for tvdpi that are scaling poorly.

That said, your image is being stretched. Change your ImageView to have a height and width of wrap_content.

In addition... if you want to target resources to the 7" tablet, what abel said below of using -swXXX is the new standard way of handling it. Unfortunately -swXXX was introduced in Android 3.2.. meaning the #1 7" tablet, the Kindle Fire would not see the contents of that folder. For the moment I am still leaning on -large but looking forward to a time when -swXXX is the norm.

于 2012-10-03T14:45:47.407 に答える