I have this code:
<?xml version="1.0" encoding="UTF-8"?>
<RelativeLayout xmlns:android="http://schemas.android.com/apk/res/android"
android:id="@+id/RelativeLayout02"
android:layout_width="fill_parent"
android:layout_height="fill_parent" >
<ImageView android:id="@+id/terranlogo1"
android:layout_width="100dp"
android:layout_height="100dp"
android:src="@drawable/terranlogo"
android:layout_centerHorizontal="true"
/>
<ImageView android:id="@+id/protosslogo1"
android:layout_width="100dp"
android:layout_height="100dp"
android:gravity="top|right"
android:src="@drawable/protosslogo"
/>
<ImageView android:id="@+id/zergologo1"
android:layout_width="100dp"
android:layout_height="100dp"
android:gravity="top|left"
android:src="@drawable/zerglogo"
/>
The image view on the right is not showing. The other 2 are just fine, I even tried setting them to 50 dp and the “protosslogo1” still does not show. What am I doing wrong?
Thanks, All help is appreciated- Lijap
Position your
ImageViewslike this:Right now
protosslogo1is behindzergologo1. You’re usingandroid:gravitythat is used to place the content(and the size of yourImageViewis fixed so it doesn’t matter) of theView. Second, you don’t have any rules set on yourImageViewsso they are placed by default(in aRelativeLayout) in the top-left corner.