I’ve a two line listview with the following XML for the row:
<?xml version="1.0" encoding="utf-8"?>
<LinearLayout xmlns:android="http://schemas.android.com/apk/res/android"
android:layout_width="fill_parent"
android:orientation="vertical"
android:layout_height="?android:attr/listPreferredItemHeight"
android:padding="6dip"
android:gravity="center_vertical"
>
<TextView
android:id="@+id/designation"
android:layout_width="fill_parent"
android:layout_height="match_parent"
android:layout_weight="1"
android:gravity="center_vertical"
android:textSize="18sp"
android:textStyle="bold" />
<TextView
android:layout_width="fill_parent"
android:layout_height="0dip"
android:layout_weight="2"
android:id="@+id/orderedValue"
android:gravity="bottom"
android:singleLine="true"
android:ellipsize="marquee"
/>
</LinearLayout>
what I want is to have the first row (designation) to be at the exact vertical center of the row, and the second row (orderedValue) just below it
I’ve been trying with several combinations of LinearLayout/Relative layout, gravity vs layout_gravity for the TextViews to no avail
Any help/pointers here?
iTurki, thanks for the input, but I just solved it before reading your solution.
I switched to a relative layout and changed some parameters, most importantly adding: android:layout_centerVertical=”true”.
here is my final layout:
Thank you both for your interest!