Samsung Galaxy S4 resolution is of 1080 x 1920. I made a PSD of this size and did slicing.
After slicing, I put these into my project and coded something like this for ImageView.
<ImageView
android:id="#+id/imageView1"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:layout_marginTop="10dp"
android:layout_gravity="center_horizontal"
android:src="#drawable/logo" />
Even when I run, it shows too big in my Android device.
I little studies over internet and found that it must divide it with 3, to get
1080 / 3 = 360 dp
1920 / 3 = 640 dp
where it says to slice it on 360 x 640.
On the other end, I found that it must be 640 x 960
Can anyone tell me what PSD I should choose and than do its respective slicing.
If you can give for all sizes, It would be helpful for me.
ldpi
mdpi
hdpi
xhdpi
xxhdpi
xxxhdpi
Thanks.
For Android Devices
LDPI- icon-36x36, splash-426x320
MDPI- icon-48x48, splash-470x320
HDPI- icon 72x72, splash- 640x480
XHDPI- icon-96x96, splash- 960x720
XXHDPI- icon- 144x144
For Android Tablet Devices
LDPI:
Portrait: 200x320px
Landscape: 320x200px
MDPI:
Portrait: 320x480px
Landscape: 480x320px
HDPI:
Portrait: 480x800px
Landscape: 800x480px
XHDPI:
Portrait: 720px1280px
Landscape: 1280x720px
For More Details You Can see Developers Guide Here
Thanks.!
Related
Firstly I did a lot of search to understand how it work, but I don't find simples tutorials. An exemple, this view:
These are my drawables folders:
The selected device is: Pixel 5.0 1080 x 1920 (xxhdpi).
Immagine in this resolution (1080 x 1920) I set the image view on the top in blue color (Solutis) with 700px of width and 250 px of height, how I have to resize this images for each drawables folders ?
I found this informations:
LDPI - 0.75x
MDPI - Original size // means 1.0x here
HDPI - 1.5x
XHDPI - 2.0x
XXHDPI - 3x
XXXHDPI - 4.0x
And
LDPI: Portrait: 200 X 320px
MDPI: Portrait: 320 X 480px
HDPI: Portrait: 480 X 800px
XHDPI: Portrait: 720 X 1280px
XXHDPI: Portrait: 960 X 1600px
XXXHDPI: Portrait: 1440 x 2560px
Here I don't understand why when I select my vistuel device 1080 x 1920px on the Design Edit it say xxhdpi and xxhdpi is 960 X 1600px...
And what gonna be the different sizes of the image for the differents drawables ?
If someone can publish a project exemple, I wool look on, please.
Did you check the documentation? Here is the interesting part:
Density-independent pixel (dp)
A virtual pixel unit that you should use when defining UI layout, to express layout dimensions or position in a density-independent way.
The density-independent pixel is equivalent to one physical pixel on a 160 dpi screen, which is the baseline density assumed by the system for a "medium" density screen. At runtime, the system transparently handles any scaling of the dp units, as necessary, based on the actual density of the screen in use. The conversion of dp units to screen pixels is simple: px = dp * (dpi / 160). For example, on a 240 dpi screen, 1 dp equals 1.5 physical pixels. You should always use dp units when defining your application's UI, to ensure proper display of your UI on screens with different densities.
This means if your device as a higher density a bigger image will been chosen.
I have created an Android application that contains 6 imageviews, and some texts.. the size of the APK file is about (2 Megabyte). When I run the application of a real Android Device (HTC One M8-eye) it takes about (66 MegaByte) RAM of the device (Allocated Memory).
I also used (leakcanary), and the result is (there is no leak) in this app.
Is it normal?
is there any suggestions to reduce this size??
Any answer is appreciated..
Thanks
This problem can be solved by creating different drawable folders (LDPI, MDPI, HDPI, XHDPI, XXHDPI, XXXHDPI).
I also used the (android drawable importer plugin) to import photos and generate different sizes and put them to different drawable folders.
Following are some important information:
LDPI: Portrait: 200 X 320px. Landscape: 320 X 200px.
MDPI: Portrait: 320 X 480px. Landscape: 480 X 320px.
HDPI: Portrait: 480 X 800px. Landscape: 800 X 480px.
XHDPI: Portrait: 720 X 1280px. Landscape: 1280 X 720px.
XXHDPI: Portrait: 960 X 1600px. Landscape: 1600 X 960px.
XXXHDPI: Portrait: 1280 X 1920px. Landscape: 1920 X 1280px.
The Result:: Used ammount of RAM is reduced from 60 Mega to about 13 Mega.
I have a background for my app in resolutions 720x1280 pixels, 1080x1920 pixels and 1440x2560 pixels.
In which folders (mdpi, hdpi, xhdpi and xxhdpi) should I put each background?
Please read the Android Documentation regarding screen sizes.
From a base image size, there is a 3:4:6:8:12:16 scaling ratio in drawable size by DPI.
LDPI - 0.75x
MDPI - Original size // means 1.0x here
HDPI - 1.5x
XHDPI - 2.0x
XXHDPI - 3x
XXXHDPI - 4.0x
For example, 100x100px image on a MDPI will be the same size of a 200x200px on a XHDPI screen.
Require Screen sizes for splash :
LDPI: Portrait: 200 X 320px
MDPI: Portrait: 320 X 480px
HDPI: Portrait: 480 X 800px
XHDPI: Portrait: 720 X 1280px
XXHDPI: Portrait: 960 X 1600px
XXXHDPI: Portrait: 1440 x 2560px
Require icon Sizes for App :
http://iconhandbook.co.uk/reference/chart/android/
DP size of any device is (actual resolution / density conversion factor).
Density conversion factor for density buckets are as follows:
ldpi: 0.75
mdpi: 1.0 (base density)
hdpi: 1.5
xhdpi: 2.0
xxhdpi: 3.0
xxxhdpi: 4.0
Examples of resolution/density conversion to DP:
ldpi device of 240 X 320 px will be of 320 X 426.66 DP. 240 / 0.75 = 320 dp 320 / 0.75 = 426.66 dp
xxhdpi device of 1080 x 1920 pixels (Samsung S4, S5) will be of 360 X 640 dp. 1080 / 3 = 360 dp 1920 / 3 = 640 dp
This image show more:
For more details about DIP read here.
Check the image above I hope it will help someone.
Link to the whole article itself
Your inputs lack one important information of device dimension.
Suppose now popular phone is 6 inch(the diagonal of the display), you will have following results
DPI: Dots per inch - number of dots(pixels) per segment(line) of 1 inch.
DPI=Diagonal/Device size
Scaling Ratio= Real DPI/160.
160 is basic density (MHDPI)
DP: (Density-independent Pixel)=1/160 inch, think of it as a measurement unit
in order to know the phone resolution simply create a image with label mdpi, hdpi, xhdpi and xxhdpi. put these images in respective folder like mdpi, hdpi, xhdpi and xxhdpi. create a image view in layout and load this image.
the phone will load the respective image from a specific folder. by this you will get the phone resolution or *dpi it is using.
I'm trying to display an image in an ImageView on 10' lenovo yoga. In each drawable folder I have put an instance of the same image with different sizes:
ldpi: 184 x 294
mdpi: 248 x 397
hdpi: 375 x 600
xhdpi: 496 x 794
xxhdpi: 800 x 1280
The images are the screenshots I've taken with the same device with xxhdpi image being the original image. The problem is instead of loading the image from a high res folder it is loading the image from mdpi and thus the result is blurry. Why is it doing this?
The drawable folders refer to screen density I believe. At http://developer.android.com/guide/practices/screens_support.html it says,
A set of six generalized densities:
ldpi (low) ~120dpi
mdpi (medium) ~160dpi
hdpi (high) ~240dpi
xhdpi (extra-high) ~320dpi
xxhdpi (extra-extra-high) ~480dpi
xxxhdpi (extra-extra-extra-high) ~640dpi
I looked up the specs of the 10' lenovo yoga and depending on the one you own, the screen density will be different. For example the Yoga 10 has 149 ppi and the lenovo yoga 2 pro has 276 ppi. So that could be the reason why it's pulling from the lower resolution drawable folders.
The Splash screen is being condensed for some reason. The sizes I currently have are correct at so this leads me to think it has to do with something related to the xml files. Can someone help?
LDPI:
Portrait: 200x320px
MDPI:
Portrait: 320x480px
HDPI:
Portrait: 480x800px
XHDPI:
Portrait: 720px1280px
Here are screenshots of the condensed/error version (on Left and captured on Samsung s4) and the correct version (on right and captured on Nexus 7):
Splash Screens for the Android Platform :-
Place 9-patch image files in the Android project's platforms/android/res/drawable* directories.
The size for each should be:
xlarge (xhdpi): at least 960 × 720
large (hdpi): at least 640 × 480
medium (mdpi): at least 470 × 320
small (ldpi): at least 426 × 320
Refer Phonegap Document