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.
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.
48 × 48 (mdpi) , with 1 dp padding. 72 × 72 (hdpi), with 1 dp padding. 96 × 96 (xhdpi), with 1 dp padding.
Take note that the size of the icons are 219 x 219 pixels.
The Android Design Guide has a page that describes recommended icon dimensions. In short, launcher icons are 48x48 dp.
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With