Skip to content

Instantly share code, notes, and snippets.

@okaybroda
Created December 30, 2015 09:07
Show Gist options
  • Save okaybroda/6f7b99cba43d189f616a to your computer and use it in GitHub Desktop.
Save okaybroda/6f7b99cba43d189f616a to your computer and use it in GitHub Desktop.
Example to align an ImageView to the baseline of a TextView.
<?xml version="1.0" encoding="utf-8"?>
<RelativeLayout xmlns:android="http://schemas.android.com/apk/res/android"
android:layout_width="match_parent" android:layout_height="match_parent">
<ImageView
android:id="@+id/imageViewHello"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:src="@drawable/img_star_05"
android:baselineAlignBottom="true"
android:layout_alignBaseline="@+id/textViewHello"
android:layout_toRightOf="@+id/textViewHello"
android:layout_toEndOf="@+id/textViewHello" />
<TextView
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:text="New Text"
android:id="@+id/textViewHello"
android:layout_alignParentTop="true"
android:layout_alignParentLeft="true"
android:layout_alignParentStart="true" />
</RelativeLayout>
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment