In android, we could determine resources by screen density, such as LDPI, HDPI, and MDPI.
I hope to build a user interface with TextLayout that will have the same width and height as the ImageView next to it. ImageView contains an image with the same size as the launch icon (72px for HDPI, etc.).
Is there a way to find out that the icon has a specific width-width in 'dp' (without kwnoi, so I can hard code XML. I think this is possible because dp is device independent, but could not find a way to get 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" />
I need X and Y values, so both will have the same size.
source share