I have two identical, equally-sized RelativeLayouts with some text and an image that I want to be aligned to the right side. However, there seems to be some sort of padding that doesn't let me put it on the right, even though I never specified this.
Here is my code:
<LinearLayout
android:baselineAligned="false"
android:layout_width="fill_parent"
android:layout_height="wrap_content"
android:orientation="horizontal">
<RelativeLayout
android:id="@+id/my_relativelayout"
android:background="@drawable/my_background"
android:layout_weight="1"
android:layout_width="0dp"
android:layout_height="wrap_content"
android:gravity="right">
<TextView
android:id="@+id/my_textview"
android:textAppearance="?android:attr/textAppearanceButton"
android:layout_centerVertical="true"
android:layout_width="wrap_content"
android:layout_height="wrap_content">
</TextView>
<ImageView
android:id="@+id/my_imageview"
android:layout_centerVertical="true"
android:scaleType="center"
android:src="@drawable/my_image"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:layout_toRightOf="@id/my_textview">
</ImageView>
</RelativeLayout>
<RelativeLayout
... same thing here ...>
</RelativeLayout>
</LinearLayout>
Edit: The empty space IS NOT the other RelativeLayout. The other RelativeLayout is another "blue rectangle" with text and an image, and is also experiencing the issue of the space on the right side. Like so: