mardi 25 août 2015

ImageView centerCrop overflows ImageView bounds?

I have the following layout:

<?xml version="1.0" encoding="utf-8"?>
<FrameLayout xmlns:android="http://ift.tt/nIICcg"
    xmlns:tools="http://ift.tt/LrGmb4"
    android:layout_gravity="top|center"
    android:background="@drawable/rounded_corner"
    android:layout_marginTop="50dp"
    android:layout_width="250dp"
    android:layout_height="350dp">

    <ImageView
        android:id="@+id/imageView1"
        android:layout_width="match_parent"
        android:layout_height="270dp"
        android:scaleType="centerCrop"
        android:adjustViewBounds="true"
        android:src="@drawable/card_image"
        android:layout_gravity="top"
        android:layout_marginTop="0dp"/>

</FrameLayout>

The image should fill the image with its rectangle and scale it keeping its aspect ratio. It works fine when I do not move the view:

enter image description here

But, when I move the view, the image is drawn outside of its bounds:

enter image description here

I am using this library to move the card.

How do I prevent that the ImageView draws its image outside its bounds?



from Newest questions tagged java - Stack Overflow http://ift.tt/1Id1edJ
via IFTTT

Aucun commentaire:

Enregistrer un commentaire