Android:中心屏幕中的ImageView

use*_*822 -1 android image screen center imageview

我有一个全屏幕背景图片RelativeLayout.和其他图像(100x100)ImageView.

我想放在ImageView中心屏幕.但我的图像显示在左上方.

问题是什么?

XML

<RelativeLayout xmlns:android="http://schemas.android.com/apk/res/android"
android:layout_width="match_parent"
android:layout_height="match_parent"
android:background="@drawable/fondo_inicio" >

<ImageView android:layout_width="80dp"
    android:layout_height="80dp"
    android:layout_gravity="center"
    android:gravity="center"
    android:background="@drawable/icono_inicio"/>

</RelativeLayout>
Run Code Online (Sandbox Code Playgroud)

M D*_*M D 10

试试这个吧 ImageView

android:layout_centerInParent="true"
Run Code Online (Sandbox Code Playgroud)