Misaligned images

4

I'm using the following .xml as the main screen:

<RelativeLayout xmlns:android="http://schemas.android.com/apk/res/android"
    android:orientation="vertical"
    android:layout_width="match_parent"
    android:layout_height="match_parent">


    <TableLayout
        android:layout_width="match_parent"
        android:layout_height="wrap_content"
        android:stretchColumns="*">

    <TableRow
        android:layout_width="wrap_content"
        android:layout_height="match_parent"
        android:layout_marginTop="15dp">

    <TextView
        android:drawableTop="@mipmap/gasolina"
        android:layout_width="45dp"
        android:layout_height="match_parent"
        android:text="ÁLCOOL X GASOLINA"
        android:onClick="iniciarTela1"
        android:padding="30dp"
        android:gravity="center"
        android:textColor="#7d7d7d" />

    <TextView
        android:drawableTop="@mipmap/moedas"
        android:layout_width="45dp"
        android:layout_height="match_parent"
        android:text="QUANTO VOU GASTAR?"
        android:onClick="iniciarTela2"
        android:padding="20dp"
        android:gravity="center"
        android:textColor="#7d7d7d" />


</TableRow>

    <TableRow
        android:layout_width="wrap_content"
        android:layout_height="match_parent"
        android:layout_marginTop="15dp">

        <TextView
            android:drawableTop="@mipmap/grafico"
            android:layout_width="45dp"
            android:layout_height="match_parent"
            android:text="MÉDIA POR KM PERCORRIDO"
            android:onClick="iniciarTela3"
            android:padding="30dp"
            android:gravity="center"
            android:textColor="#7d7d7d" />

        <TextView
            android:drawableTop="@mipmap/grafico2"
            android:layout_width="45dp"
            android:layout_height="match_parent"
            android:text="MÉDIA POR KM INICIAL/FINAL"
            android:onClick="iniciarTela4"
            android:padding="20dp"
            android:gravity="center"
            android:textColor="#7d7d7d" />


    </TableRow>

</TableLayout>

    <TextView
        android:layout_width="match_parent"
        android:layout_height="wrap_content"
        android:text="AVALIAR APP"
        android:onClick="avaliar"
        android:padding="15dp"
        android:gravity="center"
        android:background="#122d98"
        android:layout_alignParentBottom="true"
        android:textColor="#fff"
        android:textSize="16dp" />


</RelativeLayout>

It looks like this on the screen:

Theproblemisthattheimagesinthesecondcolumnarehigher(theyarenotaligned)untilImadearedlinetogetclearer:

What am I doing wrong? how can I fix this problem?

    
asked by anonymous 14.12.2016 / 18:53

2 answers

3

The error you are experiencing is in the android:padding property of your TextView .

You are setting 30dp and 20dp . Try to keep this value uniform for both TextView 's.

<TextView
    android:drawableTop="@mipmap/grafico2"
    android:layout_width="45dp"
    android:layout_height="match_parent"
    android:text="MÉDIA POR KM INICIAL/FINAL"
    android:onClick="iniciarTela4"
    android:padding="20dp" <!-- altere esse valor para ambos TextView's -->
    android:gravity="center"
    android:textColor="#7d7d7d" />
    
14.12.2016 / 19:14
-1

Have you tried using:

Ex:

layout_marginTop=

Or

Layout_marginBotton=

In images

    
14.12.2016 / 19:16