Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

RoundedCorners not work #96

Closed
mt131 opened this issue Sep 12, 2019 · 6 comments
Closed

RoundedCorners not work #96

mt131 opened this issue Sep 12, 2019 · 6 comments
Labels
bug Something isn't working

Comments

@mt131
Copy link

mt131 commented Sep 12, 2019

holder.imageViewCover.scaleType = ImageView.ScaleType.CENTER_CROP
holder.imageViewCover.load(producList[position].cover_image) {
transformations(RoundedCornersTransformation(32f))
}

but the image is not rounded conner

@mt131 mt131 added the bug Something isn't working label Sep 12, 2019
@jeziellago
Copy link

@mt131 Could you add more details about it?

@mt131
Copy link
Author

mt131 commented Sep 13, 2019

it is an imageView in a recycleview

    android:id="@+id/imageViewCover"
    android:layout_width="0dp"
    android:layout_height="0dp"
    android:layout_marginStart="8dp"
    android:layout_marginTop="4dp"
    android:layout_marginEnd="8dp"
    android:layout_marginBottom="4dp"
    app:layout_constraintBottom_toBottomOf="parent"
    app:layout_constraintEnd_toEndOf="parent"
    app:layout_constraintStart_toStartOf="parent"
    app:layout_constraintTop_toTopOf="parent"
    app:layout_constraintVertical_bias="0.5"

override fun onBindViewHolder(holder: Song2Holder, position: Int) {

    holder.imageViewCover.scaleType = ImageView.ScaleType.CENTER_CROP
    holder.imageViewCover.load(producList[position].cover_image) {
        transformations(RoundedCornersTransformation(32f))
    }
   

}

@mt131
Copy link
Author

mt131 commented Sep 15, 2019

it is not work in 1 project but working in other project now

@mt131 mt131 closed this as completed Sep 15, 2019
@JcMinarro
Copy link

It is not working fine for me either.
Some pictures are rounded but other ones not.
It is the same case, I am trying to load pictures into a recyclerView that has a GridLayoutManager with three columns. The holder will take the size depending on the screen size, and it is always squared thanks to the constraint condition I add to the picture (app:layout_constraintDimensionRatio="H,1:1")

It is my ImageView xml:

<ImageView
        android:id="@+id/file_image"
        android:layout_width="match_parent"
        android:layout_height="0dp"
        android:layout_margin="1dp"
        android:scaleType="centerCrop"
        android:adjustViewBounds="true"
        app:layout_constraintDimensionRatio="H,1:1"
        app:layout_constraintBottom_toBottomOf="parent"
        app:layout_constraintEnd_toEndOf="parent"
        app:layout_constraintStart_toStartOf="parent"
        app:layout_constraintTop_toTopOf="parent"
        />

@0xMatthewGroves
Copy link

0xMatthewGroves commented Dec 8, 2019

The RoundedCornersTransformation does work, but what I found while testing is that the source Bitmap is rounded, not the ImageView itself (which is probably what you're expecting). So if the image ends up rounded, then scaled into the Imageview via centercrop (the ScaleType you specified), you'll lose those corners.

I was also expecting "RoundedCornersTransformation" to round the image post-scaling so you see those transformations in the view itself.

@colinrtwhite
Copy link
Member

@FrostRocket Yep, it's "technically" working, though definitely not the desired behaviour. Tracking the fix here.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
bug Something isn't working
Projects
None yet
Development

No branches or pull requests

5 participants