i'm in stuck. The problem is how to place text on a static image and keep position depends on it between different screen resolutions. To achive this i've tried the layout above:
<?xml version="1.0" encoding="utf-8"?>
<RelativeLayout xmlns:android="http://schemas.android.com/apk/res/android"
android:orientation="vertical"
android:layout_width="match_parent"
android:layout_height="match_parent"
android:background="@android:color/black"
android:padding="@dimen/default_view_padding">
<ImageView
android:id="@+id/iv_background"
android:layout_width="500dp"
android:adjustViewBounds="true"
android:layout_height="900dp"
android:layout_centerInParent="true"
android:src="@drawable/example"/>
<TextView
android:layout_alignLeft="@id/iv_background"
android:layout_alignStart="@id/iv_background"
android:layout_alignEnd="@id/iv_background"
android:layout_alignRight="@id/iv_background"
android:layout_alignTop="@id/iv_background"
android:layout_width="wrap_content"
android:layout_marginTop="190dp"
android:layout_height="wrap_content"
android:layout_centerHorizontal="true"
android:gravity="center"
android:text="Dummy text string"/>
</RelativeLayout>
But on different screens it looks differently. So, by example, screenshots. The static image background, the view with text on nexus5, on nexus7. As you can see, a text placed on different places over image. I doesn't know why is it happend, becouse i'm using dp and relative layout.
I tried wrap_content/match_parent on image sizes, without ajust view bounds etc. And it haven't help. Ty for answers
0 comments:
Post a Comment