Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

Android: Launcher Icon width and height in DP

In android we could define resources by screen density such as LDPI, HDPI and MDPI.

I am hoping to build a UI that has a TextLayout that is the same width and height as the the ImageView next to it. The ImageView hosts an image, the same size as the launcher icon (72px for HDPI and so on).

Is there a way to know that the icon has a specific width-height in 'dp' (without kwnoi so I can hard code the XML. I think this is possible because dp is independent of device but couldn't find any way of getting the values in dp.

<TextView 
    android:id="@+id/holidaylistitem_day"
    android:layout_width="<X>dp"
    android:layout_height="<Y>dp" 
    android:text="1st"/>

<ImageView 
    android:id="@+id/holidaylistitem_type"
    android:src="@drawable/ic_launcher"
    android:layout_width="wrap_content"
    android:layout_height="wrap_content" />

What i need is the X and Y values so both will be of same size.

like image 222
Ziyan Junaideen Avatar asked Mar 05 '12 13:03

Ziyan Junaideen


People also ask

What is the size of an Android app icon?

On Android devices, launcher icons are generally 96×96, 72×72, 48×48, or 36×36 pixels (depending on the device), however Android recommends your starting artboard size should be 864×864 pixels to allow for easier tweaking.

What is default size of the launcher icon?

48 × 48 (mdpi) , with 1 dp padding. 72 × 72 (hdpi), with 1 dp padding. 96 × 96 (xhdpi), with 1 dp padding.

How many pixels is a Samsung icon?

Take note that the size of the icons are 219 x 219 pixels.


1 Answers

The Android Design Guide has a page that describes recommended icon dimensions. In short, launcher icons are 48x48 dp.

like image 148
Sparky Avatar answered Sep 28 '22 08:09

Sparky