How do I align the text in the text-area on bottom?

Philipp :

I want to align the text of this two labels on it's bottom, so the two values are aligned on the same height.

Sadly, I dont find an option like aligning it inside its own area. gravity wont work. It has to be in xml.

Thank you!

<TextView
        android:id="@+id/feed_euro"
        android:layout_width="wrap_content"
        android:layout_height="wrap_content"
        android:layout_toStartOf="@+id/feed_cent"
        android:height="35dp"
        android:text="23"
        android:textColor="@color/colorTextBlack"
        android:textSize="25dp" />

    <TextView
        android:id="@+id/feed_cent"
        android:layout_width="wrap_content"
        android:layout_height="wrap_content"
        android:layout_alignParentEnd="true"
        android:layout_alignParentRight="true"
        android:height="35dp"
        android:text=",39 €"
        android:textAlignment="textStart"
        android:textColor="@color/colorTextBlack" />
Dileepa Nipun Salinda :

You can change the gravity to bottom like below.

<TextView
    android:id="@+id/feed_euro"
    android:layout_width="wrap_content"
    android:layout_height="wrap_content"
    android:layout_toStartOf="@+id/feed_cent"
    android:height="35dp"
    android:text="23"
    android:textColor="@color/colorTextBlack"
    android:textSize="25dp" />

<TextView
    android:id="@+id/feed_cent"
    android:layout_width="wrap_content"
    android:layout_height="wrap_content"
    android:layout_alignParentEnd="true"
    android:layout_alignParentRight="true"
    android:height="35dp"
    android:text=",39 €"
    android:gravity="bottom"
    android:textAlignment="textStart"
    android:textColor="@color/colorTextBlack" />

And also you can try android:gravity="bottom" to the layout you have used to hold the both TextView and change the 2nd TextView height into wrap_content.

Hope you got the answer.

Guess you like

Origin http://43.154.161.224:23101/article/api/json?id=80500&siteId=1