Reputation: 1140
There is a picture that needs to be placed in the center of the background image. Why doesn't the picture become centered on top of another background image? It turns out at the top left, but not in the center.
Here is the code:
<?xml version="1.0" encoding="utf-8"?>
<RelativeLayout xmlns:android="http://schemas.android.com/apk/res/android"
xmlns:app="http://schemas.android.com/apk/res-auto"
android:layout_width="match_parent"
android:layout_height="match_parent"
android:gravity="center">
<ImageView
android:layout_height="match_parent"
android:layout_width="match_parent"
android:scaleType="fitXY"
android:src="@drawable/background"/>
<ImageView
android:id="@+id/splash_logo"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:gravity="center"
android:scaleType="centerCrop"
android:src="@drawable/splashlogo2" />
</RelativeLayout>
Upvotes: 0
Views: 70
Reputation: 2937
Have you tried replacing android:gravity...
with android:layout_centerInParent="true"
Upvotes: 2