Android crop ImageView inside parent RelativeLayout

android, crop, image, java, scale

Solution

Ok, I managed how to do that. Instead of using `RelativeLayout`, I used `FrameLayout` and it worked perfectly.

Here's the code:

<FrameLayout android:id="@+id/time_foregrd"
    android:layout_width="57px"
    android:layout_height="100px"
    android:layout_marginLeft="100px"
    android:layout_marginTop="285px"
   >
    <ImageView  android:layout_width="57px"
                android:layout_height="338px"
                android:layout_gravity="bottom"
                android:scaleType="fitXY"
                android:src="@drawable/time_foreground"
                />
</FrameLayout>

Problem

I would like to know how can I crop a `ImageView` that have a scaled background image using a fixed width and height on it's `parent`. Basically, I want an image to be scaled using `ImageView android:background` and then I want to crop the portion of the image that is outside the parent's bounds. Until now, I have this code: ``` <RelativeLayout android:id="@+id/time_foregrd" android:layout_width="57px" android:layout_height="100px" android:layout_marginLeft="100px" android:layout_marginTop="285px" android:clipChildren="true" > <ImageView android:layout_width="57px" android:layout_height="338px" android:minWidth="57px" android:minHeight="338px" android:background="@drawable/time_foreground" /> </RelativeLayout> ``` But it doesn't work... What am I doing wrong?

Original source