I've done further tests on this and the description of the problem wasn't
entirely accurate.

If I set up a RelativeLayout and put a ViewImage (with the image on the
background - not the src) so that it's partly inside and partly outside the
screen bounds, the image will scale rather than clip.  I am seeing the same
result when preforming a frame-to-frame animation on the image, but it's
easier to show using a static background image.

This is the Layout XML for the example (using the icon as it's there as a
default image)

<?xml version="1.0" encoding="utf-8"?>
<RelativeLayout android:id="@+id/RelativeLayout01"
android:layout_width="fill_parent" android:layout_height="fill_parent"
xmlns:android="http://schemas.android.com/apk/res/android";
android:clipChildren="false" android:clipToPadding="false">
<ImageView android:layout_height="wrap_content"
android:id="@+id/ImageView01"
android:layout_width="wrap_content" android:layout_marginLeft="300dp"
android:background="@drawable/icon">
</ImageView>
</RelativeLayout>

Using the above layout you can see the scaling happen in the Graphical
Layout view in Eclipse (using "2.7 in QVGA config).

So how can I make this clip rather than scale?  As far as I know, I have to
use the background rather than source so that I can add my frame-by-frame
animation to it.

Many thanks in advance,

Cliff

On Thu, Jan 13, 2011 at 9:00 PM, Rok <[email protected]> wrote:

> I'm using a RelativeLayout which contains a number of ImageViews positioned
> in XML using dp measurements. Some of the ImageViews are deliberately
> offscreen (outside the bounds of the RelativeLayout which is set to fill
> parent horizontally and vertically).
>
> I noticed that ImageViews which clipped the edge of the RelativeLayout's
> bounds were scaling to fit inside the layout. I didn't want this, and got
> the desired behaviour by changing the layout's ClipChildren to "false" and
> setting the ImageView's scaling to "center".
>
> But when I use the ImageViews to display frame-by-frame animations (in
> background property of ImageView) instead of static images (in src property
> of ImageView) the animations are scaling to fit in the Layout if they lie
> across the bounds of it.
>
> Does anyone know how I can stop this from happening?
>
> --
> You received this message because you are subscribed to the Google
> Groups "Android Developers" group.
> To post to this group, send email to [email protected]
> To unsubscribe from this group, send email to
> [email protected]<android-developers%[email protected]>
> For more options, visit this group at
> http://groups.google.com/group/android-developers?hl=en

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

Reply via email to