0

I have some view and TextView. TextView can have one or more lines. I want align first line TextView to bottom of some view:

enter image description here

enter image description here

UPD: Now I use manual marginTop for TextView:

<LinearLayout
            android:id="@+id/user_thumb_group"
            android:layout_width="wrap_content"
            android:layout_height="wrap_content"
            android:orientation="horizontal" >
...
</LinearLayout>

<TextView
            android:id="@+id/message"
            android:layout_width="wrap_content"
            android:layout_height="wrap_content"
            android:layout_marginLeft="@dimen/dips8"
            android:layout_marginTop="33dp"
            android:layout_toRightOf="@id/user_thumb_group"
            android:clickable="true"
            android:text="message" />
Yura Shinkarev
  • 5,134
  • 7
  • 34
  • 57

1 Answers1

0

Align the top of the TextView with the bottom of the LinearLayout and give the TextView a negative top margin that is equal to the text size:

<LinearLayout
        android:id="@+id/user_thumb_group"
        android:layout_width="wrap_content"
        android:layout_height="wrap_content"
        android:orientation="horizontal" >
...
</LinearLayout>

<TextView
        android:id="@+id/message"
        android:layout_width="wrap_content"
        android:layout_height="wrap_content"
        android:layout_marginLeft="@dimen/dips8"
        android:layout_toRightOf="@id/user_thumb_group"
        android:layout_below="@id/user_thumb_group"
        android:textSize="20sp"
        android:layout_marginTop="-20dp"
        android:clickable="true"
        android:text="message" />
Steven Meliopoulos
  • 4,450
  • 4
  • 34
  • 36