cesards / SuperImageView

Crop and Rounded Corners added to an ImageView.
MIT License
654 stars 111 forks source link

doesn't crop in xml #22

Closed stavkidron closed 6 years ago

stavkidron commented 7 years ago

I tried using the library in xml according to the example and the image does not get cropped, it just shows the full image. I want the image to be cropped at the bottom. I tried any of the options, without any affect. How do I make it work in xml?

cesards commented 7 years ago

Could you provide more information? Screenshot? Phone? your XML?

stavkidron commented 7 years ago

edit: my bad, I got an error after rebuilding the project:

Error:(224) No resource identifier found for attribute 'civ_crop' in package 'com.mypackage'

dependencies in build.gradle:

dependencies {
    compile fileTree(dir: 'libs', include: ['*.jar'])
    androidTestCompile('com.android.support.test.espresso:espresso-core:2.2.2', {
        exclude group: 'com.android.support', module: 'support-annotations'
    })
    compile 'com.android.support:appcompat-v7:25.1.0'
    compile 'com.amazonaws:aws-android-sdk-ec2:2.2.+'
    compile 'com.amazonaws:aws-android-sdk-core:2.2.8'
    compile 'com.amazonaws:aws-android-sdk-cognito:2.2.+'
    compile 'com.android.support:design:25.1.0'
    compile 'com.cesards.android:cropimageview:1.0.2.1'
    testCompile 'junit:junit:4.12'
}

this is my code:

<LinearLayout xmlns:android="http://schemas.android.com/apk/res/android"
    xmlns:custom="http://schemas.android.com/apk/res-auto"
    android:orientation="vertical"
    android:layout_width="match_parent"
    android:layout_height="match_parent">

    <com.cesards.cropimageview.CropImageView
        android:layout_width="wrap_content"
        android:layout_height="wrap_content"
        android:src="@drawable/portrait"
        custom:civ_crop="topLeft" />

</LinearLayout>

my image: image

it looks like this no matter what I write in the civ_crop: image

cesards commented 7 years ago

Are you using an emulator? A phone? what brind and OS? I need to upload a new version of the library and I want to fix any pending issue :-)

stavkidron commented 7 years ago

I'm using the android studio emulator, with android 6.0 (API level 23).

smarques84 commented 7 years ago

@cesards I do have the same problem as reported by @stavkidron on a nexus 5X running Android 7.0

Error:(53) No resource identifier found for attribute 'civ_crop' in package 'com.***'

mirandole commented 7 years ago

I have the same issue

FernandoWahl commented 7 years ago

I found the problem, the correct name of the attribute is 'crop'. Not 'civ_crop' as in example!

https://github.com/cesards/CropImageView/pull/21

cesards commented 6 years ago

@stavkidron

I'm having a look to this again. I know what's going on. You are using:

android:layout_width="wrap_content"
android:layout_height="wrap_content"

in the image, so that means that if the image is smaller than the parent/screen, it's not going to crop. You should be using match_parent for that to happen. I'm going to close this. Let me know if you keep having problems 👍