Android: Using alignBaseline for an image following text
You should use both following lines in your ImageView to align bottom of Image view to bottom of nearby TextView:
android:layout_alignBaseline="@+id/txtview"
android:baselineAlignBottom="true"
<RelativeLayout
android:layout_width="wrap_content"
android:layout_height="wrap_content" >
<TextView
android:id="@+id/txtview"
... />
<ImageView
...
android:layout_toRightOf="@+id/txtview"
android:layout_alignBaseline="@+id/txtview"
android:baselineAlignBottom="true"
...
/>
</RelativeLayout>
Since API11 you can simply use
android:baselineAlignBottom="true"
Prior to API11 you can overwrite getBaseLine()
and return image height.