Tinco De Simone Tinco De Simone - 23 days ago 11
Android Question

Make an image view look the same in every device

I have an image view and a textView.

When i test it in bigger devices, the image changes his position.

layout xml:

<TextView
android:id="@+id/monedas_pow"
android:text="300"
android:textSize="29sp"
android:layout_marginLeft="10dp"
android:textColor="@color/titlecolor"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
/>
<ImageView
android:id="@+id/summary_btn"
android:src="@drawable/coin"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:layout_marginBottom="525dp"
android:layout_toRightOf="@id/monedas_pow"
android:layout_marginTop="8dp"
android:layout_marginLeft="5dp"
android:layout_marginRight="280dp" />


It have to look like this

Answer

Its because you have huge margins on bottom and right. Just remove bottom and right margin and add android:layout_alignBaseline="@+id/monedas_pow" And you are missing + in toRightOf so add it android:layout_toRightOf="@+id/monedas_pow"