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 :(

explaination

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.xmlso margin change depending on device testing.


Comments

Popular posts from this blog

database - VFP Grid + SQL server 2008 - grid not showing correctly -

jquery - Set jPicker field to empty value -

.htaccess - htaccess convert request to clean url and add slash at the end of the url -