3

In trying to support multiple screen sizes, I created a few images with Inkscape and exported them each at different dp units for the drawable folders. I started out by creating the images for my tablet, which I tested on my asus transformer and everything looked good. So I put my tablet images in the drawable-xhdpi, which were 160dp each. So for each of those images I exported new images at 120dp, 80dp, and 60dp for the drawable-hdpi, drawable-mdpi, and drawable-ldpi folders respectively (based on Android's suggested 8:6:4:3 scaling ratio).

However, when I tested on my galaxy s3 and LG Ally, the images appear too large and they don't all fit on the screen. I've included <support-screen/> in my manifest to explicitly "support" all screens. I set anyDensity to true. I refreshed my project folder in Eclipse and also did a clean build.

I'm using a LinearLayout with an ImageView and a few ImageButtons:

<LinearLayout xmlns:android="http://schemas.android.com/apk/res/android"
xmlns:tools="http://schemas.android.com/tools"
android:orientation="vertical"
android:layout_width="match_parent"
android:layout_height="match_parent"
android:background="#FFFFFF"
tools:context=".StarsMenu" >

<ImageView
    android:id="@+id/img_title"
    android:layout_width="wrap_content"
    android:layout_height="wrap_content"
    android:layout_gravity="center_horizontal"
    android:src="@drawable/title" />

<ImageButton
    android:id="@+id/img_play_btn"
    android:layout_width="wrap_content"
    android:layout_height="wrap_content"
    android:layout_gravity="center_horizontal"
    android:background="@drawable/menu_play_imgs"/>

<ImageButton
    android:id="@+id/img_practice_btn"
    android:layout_width="wrap_content"
    android:layout_height="wrap_content"
    android:layout_gravity="center_horizontal"
    android:background="@drawable/menu_pract_imgs"/>

<ImageButton
    android:id="@+id/img_about_btn"
    android:layout_width="wrap_content"
    android:layout_height="wrap_content"
    android:layout_gravity="center_horizontal"
    android:background="@drawable/menu_about_imgs" />

And here is the manifest:

<manifest xmlns:android="http://schemas.android.com/apk/res/android"
package="com.vpbailey.RememberTheStars"
android:versionCode="1"
android:versionName="1.0" >

<uses-sdk
    android:minSdkVersion="8"
    android:targetSdkVersion="18" />

<supports-screens 
    android:anyDensity="true"
    android:smallScreens="true"
    android:normalScreens="true"
    android:largeScreens="true"
    android:xlargeScreens="true" />

<application
    android:allowBackup="true"
    android:icon="@drawable/ic_launcher"
    android:label="@string/app_name"
    android:theme="@style/AppTheme" >
    <activity
        android:name="com.vpbailey.RememberTheStars.StarsMenu"
        android:label="@string/app_name" 
        android:theme="@style/FullscreenTheme"
        android:screenOrientation="portrait">
        <intent-filter>
            <action android:name="android.intent.action.MAIN" />

            <category android:name="android.intent.category.LAUNCHER" />
        </intent-filter>
    </activity>
</application>

I have no idea how to proceed from here. It is not obvious to me what I'm doing wrong but I have a feeling its something really simple that I'm missing because this is my first Android app. Thanks in advance :)

Victoria
  • 33
  • 3

1 Answers1

3

Galaxy S3 density is xhdpi. And the density ratio goes like this:

mdpi:hdpi:xhdpi:xxhdpi:xxxhdpi: 1x:1.5x:2x:3x:4x

xxhdpi is used for phones like Galaxy s4.

xxxhdpi is used for phone like Galaxy x5.

For samsung Galaxy S3, you need to create folder drawable-sw360dp and keep images accordingly.

The below link will give you more idea:

http://developer.android.com/design/style/iconography.html

Hope it helps

Sushil
  • 8,250
  • 3
  • 39
  • 71
  • Sushil, this was very helpful. My next question is can I assume that a device that is larger than the galaxy s3 has a higher density? I think this assumption may be causing my problems as well. – Victoria Mar 06 '14 at 00:10
  • @Victoria No. This is not correct assumption. For example Galaxy Tablet 10.1 (hdpi) which is much larger than Galaxy S3 (xhdpi) has lower density. Density is nothing but number of pixels/inch. So, has nothing to do with size. – Sushil Mar 06 '14 at 00:14
  • @Victoria This link will also give you some useful insight : http://stackoverflow.com/questions/12242111/application-skeleton-to-support-multiple-screen/12258061#12258061 – Sushil Mar 06 '14 at 00:16
  • @Sushil currently there is no xxxhdpi device on the market, xxxhdpi is there just for the launcher icon to work properly with the home launcher introducted in KitKat – Hoang Huynh Jun 15 '14 at 11:53