Align first line in TextView
I have horizontally oriented LinearLayout with ImageView and TextView in
it (image at left, text at right). I want to align the first line of
TextView (even if it has multiple lines) to the center of ImageView. How
can I achieve that?
My current code, which centers the whole TextView instead of only the
first line:
<LinearLayout
android:layout_height="wrap_content"
android:layout_width="match_parent"
android:orientation="horizontal"
android:gravity="center_vertical">
<ImageView
android:id="@+id/icon_distance"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:src="@drawable/icon_distance" />
<TextView
android:duplicateParentState="true"
android:gravity="center_vertical"
style="@style/taskAddressText"
android:id="@+id/task_address"
android:layout_width="wrap_content"
android:layout_height="wrap_content" />
</LinearLayout>
No comments:
Post a Comment