Thursday, August 25, 2011

[android-developers] Re: ImageView not getting vertically centered

Can you try something like this using centerInParent?

<ImageView
android:id="@+id/preview_image"
android:layout_width="wrap_content"
android:layout_width="wrap_content"
android:layout_centerInParent="true" />

On Aug 25, 1:39 pm, Manish Garg <mannishga...@gmail.com> wrote:
> Hi All,
>
> I need to display one image on the screen who's size depends upon the
> image fetched from the server. It is getting horizontal center but not
> vertical center. When image size is large then it is displaying fine
> scroll bar is also coming but when image size is smaller the screen
> size then I am facing problem.
>
> <ScrollView
>   xmlns:android="http://schemas.android.com/apk/res/android"
>   android:layout_width="fill_parent"
>   android:layout_height="fill_parent"
>   style="@style/theme_layout">
>   <LinearLayout
>     android:layout_width="fill_parent"
>         android:layout_height="fill_parent"
>         android:id="@+id/imgLayout"
>         android:gravity="center">
>             <ImageView
>                 android:id="@+id/documentImg"
>                 android:layout_width="wrap_content"
>                 android:layout_height="wrap_content">
>             </ImageView>
>     </LinearLayout>
> </ScrollView>
>
> Regards,
> Manish Garg

--
You received this message because you are subscribed to the Google
Groups "Android Developers" group.
To post to this group, send email to android-developers@googlegroups.com
To unsubscribe from this group, send email to
android-developers+unsubscribe@googlegroups.com
For more options, visit this group at
http://groups.google.com/group/android-developers?hl=en

No comments:

Post a Comment