Android- ImageView not showing

android, gravity, imageview

Solution

Position your `ImageViews` like this:

<?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:layout_alignParentRight="true"
    android:src="@drawable/protosslogo"
    />

 <ImageView  android:id="@+id/zergologo1"
    android:layout_width="100dp"
    android:layout_height="100dp"
    android:layout_alignParentLeft="true" 
    android:src="@drawable/zerglogo"
    />

Right now `protosslogo1` is behind `zergologo1`. You're using `android:gravity` that is used to place the content(and the size of your `ImageView` is fixed so it doesn't matter) of the `View`. Second, you don't have any rules set on your `ImageViews` so they are placed by default(in a `RelativeLayout`) in the top-left corner.

Problem

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

Original source