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.
The Android Design Guide has a page that describes recommended icon dimensions. In short, launcher icons are 48×48 dp.