how to show imageview in center of the screen?

android, center, imageview

Solution

its better to Use `RelativeLayout` and add `android:centerinParent="true"` in imageView...

UPDATE ::

<?xml version="1.0" encoding="utf-8"?>
<RelativeLayout xmlns:android="http://schemas.android.com/apk/res/android"
    xmlns:pj="http://schemas.android.com/apk/res/com.globems.main"
    xmlns:bm="com.carousel.main"
    android:layout_width="fill_parent"
    android:layout_height="fill_parent"
    android:background="@drawable/blue3" >

    <com.globems.controls.Carousel
        android:id="@+id/carousel"
        android:layout_width="fill_parent"
        android:layout_height="fill_parent"
        pj:Items="@array/entries"
        pj:Names="@array/names"
        pj:SelectedItem="0"
        pj:UseReflection="true"
        android:animationDuration="200" />

    <ImageView
        android:id="@+id/imageView1"
        android:layout_width="wrap_content"
        android:layout_height="wrap_content"
        android:layout_centerInParent="true"
        android:src="@drawable/icon" />

</RelativeLayout>

Problem

I created carousel design application, it's working fine. I wish to show one default logo in center of the screen. so i am tried many ways, please help me. This is my screen shot: i wish to show one logo in center of the carousel design. This is my xml source code: ``` > <LinearLayout android:layout_weight="0.5" android:padding="5dip" android:gravity="top" android:layout_width="fill_parent" android:layout_height="fill_parent" > <com.globems.controls.Carousel android:layout_width="fill_parent" android:layout_height="fill_parent" android:id="@+id/carousel" pj:UseReflection="true" pj:Items="@array/entries" pj:Names="@array/names" pj:SelectedItem="0" android:animationDuration="200" /> <ImageView android:id="@+id/imageView1" android:layout_width="wrap_content" android:layout_height="wrap_content" android:src="@drawable/ic_launcher" /> </LinearLayout> ``` in this code I am using imageview to show the logo but its not working. Updated xml: ``` <?xml version="1.0" encoding="utf-8"?> <RelativeLayout xmlns:android="http://schemas.android.com/apk/res/android" xmlns:pj="http://schemas.android.com/apk/res/com.globems.main" xmlns:bm="com.carousel.main" android:orientation="vertical" android:layout_width="fill_parent" android:layout_height="fill_parent" android:background ="@drawable/blue3" > <RelativeLayout android:layout_weight="0.5" android:padding="5dip" android:gravity="top" android:layout_width="fill_parent" android:layout_height="fill_parent" > <com.globems.controls.Carousel android:layout_width="fill_parent" android:layout_height="fill_parent" android:id="@+id/carousel" pj:UseReflection="true" pj:Items="@array/entries" pj:Names="@array/names" pj:SelectedItem="0" android:animationDuration="200" /> <ImageView android:id="@+id/imageView1" android:layout_width="wrap_content" android:layout_height="wrap_content" android:src="@drawable/ic_launcher" android:centerinHorizontal="true" /> </RelativeLayout> </RelativeLayout> ```

Original source