Giter Site home page Giter Site logo

RoundedCorners not work about coil HOT 6 CLOSED

coil-kt avatar coil-kt commented on August 28, 2024
RoundedCorners not work

from coil.

Comments (6)

jeziellago avatar jeziellago commented on August 28, 2024

@mt131 Could you add more details about it?

from coil.

mt131 avatar mt131 commented on August 28, 2024

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))
    }
   

}

from coil.

mt131 avatar mt131 commented on August 28, 2024

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

from coil.

JcMinarro avatar JcMinarro commented on August 28, 2024

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"
        />

from coil.

0xMatthewGroves avatar 0xMatthewGroves commented on August 28, 2024

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.

from coil.

colinrtwhite avatar colinrtwhite commented on August 28, 2024

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

from coil.

Related Issues (20)

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. 📊📈🎉

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google ❤️ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.