I'm working on a project which requires a textview view with a drawable on its right or an imageview right of the textview. the problem statement is that the image shoud always align to the the text at the center. If the text is single line then everything looks fine but when text is multiline text then the image stays center to the both the lines. I have tried multiple approaches including rich drawables and verticleimage span but none helped. in the image the first and second is what i am getting so far but the third one is the what it should be the expected result (even the first one is correct if its a single line text).enter image description here
<?xml version="1.0" encoding="utf-8"?>
<RelativeLayout
xmlns:android="http://schemas.android.com/apk/res/android"
xmlns:app="http://schemas.android.com/apk/res-auto"
xmlns:tools="http://schemas.android.com/tools"
android:layout_width="@dimen/media_item_poster_width"
android:layout_height="wrap_content"
android:layout_marginEnd="@dimen/browse_media_button"
android:background="@drawable/poster_overlay_selector"
android:clickable="true"
android:focusable="true"
android:padding="@dimen/media_browser_item_padding">
<TextView
android:id="@+id/view_all_number_tv"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:layout_alignBottom="@+id/media_poster"
android:layout_marginStart="@dimen/media_item_poster"
android:layout_marginBottom="@dimen/media_item_poster"
android:ellipsize="end"
android:maxWidth="@dimen/browse_view_all_number_tv_max_width"
android:maxLines="2"
android:textColor="@color/anz_text_color_primary"
android:textSize="@dimen/media_item_poster_view_all"
app:mainResourcePkgName="@string/resource_pkg_name_global"
tools:text="48 Titles" />
<ImageView
android:id="@+id/view_all_arrow"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:src="@drawable/ic_view_all_arrow"
android:layout_alignBottom="@+id/media_poster"
android:layout_marginBottom="@dimen/media_item_poster_view_all"
android:layout_toEndOf="@+id/view_all_number_tv"
android:layout_marginStart="@dimen/view_all_arrow_margin_start"
android:layout_marginEnd="@dimen/media_item_poster_view"
app:mainResourcePkgName="@string/resource_pkg_name_module"
app:labelsResourcePkgName="@string/resource_pkg_name_global" />
</RelativeLayout>