Android:中心屏幕中的ImageView [英] Android: ImageView in center screen

查看:162
本文介绍了Android:中心屏幕中的ImageView的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我全屏显示背景图像,并带有RelativeLayout.以及ImageView中的其他图片(100x100).

I have a background image in full screen with a RelativeLayout. And other image (100x100) in an ImageView.

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

I want to put the ImageView in center screen. But my image shows top left.

出什么问题了?

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>

推荐答案

将其尝试到您的ImageView

android:layout_centerInParent="true"

这篇关于Android:中心屏幕中的ImageView的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆