question-mark
Stuck on an issue?

Lightrun Answers was designed to reduce the constant googling that comes with debugging 3rd party libraries. It collects links to all the places you might be looking at while hunting down a tough bug.

And, if you’re still stuck at the end, we’re happy to hop on a call to see how we can help out.

Add new `ShapeableImageView` component

See original GitHub issue

Currently ImageView doesn’t support material shaping. First example on this site: https://material.io/design/communication/imagery.html#

shows an image with rounded corners. This can be achieved by wrapping ImageView inside a CardView but having a built in support for material shaping would be more convenient. Not sure if it should be a ShapeableImageView component or if it would be better to create MaterialImageView and replace regular ImageView with it during inflation (similar to other components like MaterialButton for example).

Issue Analytics

  • State:closed
  • Created 4 years ago
  • Reactions:12
  • Comments:5 (3 by maintainers)

github_iconTop GitHub Comments

3reactions
tylerwilsoncommented, Dec 27, 2019

I Was excited to see this in 1.2 alpha03 release. I currently use a third-party ‘com.makeramen:roundedimageview:2.3.0’ library successfully. I also use it with Picasso 2.71828 with no issues.

I tried to replace the RoundedImageView with the included ShapeableImageView in my views which are used within a RecyclerView.ViewHolder. I found that upon scrolling, the images occasionally disappear and then may come back. Perhaps it is highlighting some other issue in my code, but perhaps it is some drawing or some other recycling that is causing the image to get dropped?

Note I am also using a Picasso placeholder like so:

Picasso.get().load(staff.imageUrl).placeholder(R.drawable.loading_icon).into(imageView)

For now I have reverted to the RoundedImageView. Hopefully this can be looked at and fixed by next release. Thank you.

Some additional info: there are a number of errors like so in the log:

E/ShapeableImageView: Shapeable Image view does not support the provided drawable. Only BitmapDrawble is supported

I set a break point and found that the drawable was actually null. So I suspect it has to do with the way Picasso is setting the drawable on the ImageView at times which cause a redraw, but if the drawable is null, perhaps it should be skipped and not drawn at all?

0reactions
ymariancommented, Jan 30, 2020

@tylerwilson that should also be fixed now. Check

https://github.com/material-components/material-components-android/issues/890#issuecomment-573690709

To see how to test with one of the latest snapshots.

Latests one is 1.2.0-dev-20200130

Read more comments on GitHub >

github_iconTop Results From Across the Web

ShapeableImageView – Material components for android
To work with ShapeableImageView in your android project, you need to add dependency material design 1.2.0 or higher.
Read more >
ShapeableImageView - Android Developers
Gets the stroke width for this ImageView. void, setContentPadding(int left, int top, int right, int bottom). Set additional padding on the image ...
Read more >
Deep Dive Into ShapeableImageView in Android - ITNEXT
Usually, we add borders to ImageViews to help them stand out more so let's how we can add that to our Circle Image...
Read more >
Shaped ImageViews — Shapeable ImageView | by Codeible
gradle file and add the dependency for Material UI Components. implementation 'com.google.android.material:material:1.6.0'. For the latest version of the ...
Read more >
ShapeableImageView – Material Components - Mobikul
Step 1: Add Material Dependency · Step 2: Add ShapeableImageView in your XML layout. · Step 3: Add circle image style in file...
Read more >

github_iconTop Related Medium Post

No results found

github_iconTop Related StackOverflow Question

No results found

github_iconTroubleshoot Live Code

Lightrun enables developers to add logs, metrics and snapshots to live code - no restarts or redeploys required.
Start Free

github_iconTop Related Reddit Thread

No results found

github_iconTop Related Hackernoon Post

No results found

github_iconTop Related Tweet

No results found

github_iconTop Related Dev.to Post

No results found

github_iconTop Related Hashnode Post

No results found