Skip to content Skip to sidebar Skip to footer

Android: Imageview In Center Screen

I have a background image in full screen with a RelativeLayout. And other image (100x100) in an ImageView. I want to put the ImageView in center screen. But my image shows top left

Solution 1:

try this to your ImageView

android:layout_centerInParent="true"

Solution 2:

Add the following to the ImageView.

android:layout_centerHorizontal="true"android:layout_centerVertical="true"

Solution 3:

<RelativeLayoutxmlns:android="http://schemas.android.com/apk/res/android"android:layout_width="fill_parent"android:layout_height="fill_parent"android:background="@drawable/fondo_inicio" ><ImageViewandroid:layout_width="80dp"android:layout_height="80dp"android:layout_centerInParent="true"android:background="@drawable/icono_inicio"/></RelativeLayout>

Solution 4:

<ImageView
        android:id="@+id/pic_id"
        android:layout_width="fill_parent"
        android:layout_height="fill_parent"
        android:scaleType="fitCenter"
        android:src="@drawable/pic" />

Solution 5:

Try this

android:layout_gravity="center"

Post a Comment for "Android: Imageview In Center Screen"