Well... I should thank you. Based on your XML, I tried
android:scaleType="fitCenter" and the image now appears as-is, without
any scaling.

I'm confused as to why this works and not just
android:scaleType="center". Based on the docs (http://
developer.android.com/reference/android/widget/
ImageView.ScaleType.html), "center" should "perform no scaling". I
tried a bunch of things, but never "fitCenter" as the
android:scaleType... So thanks!

For completeness, let me answer your question. Yes, I was saying that
the "X" gets scaled up, but not quite to the full size. When I used
android:scaleType="centerCrop", the X was scaled to fit the entire
ImageView. When I changed to android:scaleType="center", it was only
scaled up a little bit, but not to fit the entire view. And now, with
"fitCenter", it appears as-is.

On Feb 11, 7:38 am, Doug Gordon <gordo...@gmail.com> wrote:
> Are you saying that the "X" gets scaled up to the full size of the
> ImageView as though the transparent "border" were not there? I have an
> ImageView that displays photos in their "native" pixel dimensions up
> to a max size by doing this:
>
>             <ImageView android:id="@+id/photo"
>                         android:layout_width="wrap_content"
>                         android:layout_height="wrap_content"
>                         android:gravity="center"
>                         android:scaleType="fitCenter"
>                         android:maxWidth="214dip"
>                         android:maxHeight="214dip"
>                         android:adjustViewBounds="true"
>                 />
>
> This does *not* scale up images that are less than the max dimensions.
> But I might be aiming for something quite different from your case.
>
> On Feb 11, 12:22 am, Kookamonga <site...@yahoo.ca> wrote:
>
>
>
>
>
>
>
> > I have an ImageView defined like so:
>
> >                 <ImageView android:id="@+id/im_delete"
> >                                    android:layout_width="fill_parent"
> >                                    android:layout_height="40dp"
> >                                    android:background="@null"
> >                                    android:src="@drawable/delete"
> >                                    android:scaleType="center"
> >                                    android:layout_weight="1"/>
>
> > The "delete" drawable is a 60x60 png with a roughly 28x28 white X in
> > its center; the rest of the png is transparent. When this view
> > appears, the white X appears scaled (larger than original). This looks
> > ugly. Is there any way to prevent this scaling? What is causing it?
>
> > I have tried to follow Mark's suggestion here (drawable-nodpi folder),
> > but unfortunately, it didn't work:
>
> >http://groups.google.com/group/android-developers/browse_thread/threa...
>
> > I have tried android:background="@null" and android:scaleType="center"
> > and android:src, according to this:
>
> >http://stackoverflow.com/questions/2406172/android-how-to-prevent-ima...
>
> > Still no dice. I'm not sure what I'm missing here.

-- 
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+unsubscr...@googlegroups.com
For more options, visit this group at
http://groups.google.com/group/android-developers?hl=en

Reply via email to