xml - Positioning overlapped view in Android -
simply - how place 1 view on top of view (which can shrink) in strictly defined place regardless of screen resolution , density?
example - place textview on top of image on pyramides. when using margins (frame or relative layout) dp units fail on different screen size :(
xml
<framelayout android:layout_width="wrap_content" android:layout_height="wrap_content" > <imageview android:layout_width="wrap_content" android:layout_height="wrap_content" android:src="@drawable/image" /> <textview android:id="@+id/tv" android:layout_width="wrap_content" android:layout_height="wrap_content" android:layout_marginbottom="20dp" android:layout_marginleft="30dp" android:layout_gravity="left|bottom" /> </framelayout>
when using margins (frame or relative layout) dp units fail on different screen size
yes fail due other devices has different dp.
solution:
you can use values
folder of res
folder put values dimens.xml
so margin change depending on device testing.
Comments
Post a Comment