Comments (13)
If you don't mind testing, please update your dependencies to use the snapshot and let me know how it performs:
repositories {
mavenCentral()
maven {
url "https://oss.sonatype.org/content/repositories/snapshots"
}
}
dependencies {
compile 'com.makeramen:roundedimageview:1.2.4-SNAPSHOT'
}
from roundedimageview.
Will try it out.
I actually ended up implementing a RoundedColorDrawable that works very well that I had planned to PR
from roundedimageview.
doesn't work for me with custom drawable (it seems that wrong canvas size (1x1) is passed)
from roundedimageview.
what custom drawable are you passing in?
from roundedimageview.
nothing very special, just public class AvatarDrawable extends Drawable
with it's own onDraw
implementation with some drawText
's.
from roundedimageview.
Ah, I would do one of 2 things:
- Return a value > 1 in
getInstrinsicHeight()
andgetIntrinsicWidth()
. This method would fix the canvas size of 1 issue, but whatever size you return will be the size of the bitmap that gets drawn, and later stretched to fit (probably not what you want). - Instead I recommend extending
RoundedImageDrawable
instead ofDrawable
and simply doing your text drawing after callingsuper.onDraw
from roundedimageview.
first one is obviously not a solution, neither is the second one - I must call super(null);
in constructor and this causes NPE.
NB: I override draw
, not onDraw
in Drawable
(later one is for View
).
from roundedimageview.
why must you call super(null)
? you can just let RoundedDrawable
handle the bitmap part of your avatar, so call super.draw(canvas)
and just use super.setBitmap()
(or res or drawable).
Otherwise if you're already doing all the custom drawing just do canvas.drawCircle(cx, cy, r, bitmapPaint)
and you don't even need this library...
from roundedimageview.
I don't have any bitmap part of avatar.
All custom drawing (and especially round cropping) is already done, but using some library will make my code much more simple.
from roundedimageview.
This library is a convenience for people who don't want to write custom views and specifically optimizes for the case of rounded bitmaps. It's not meant to augment custom views/drawables well since the behavior most custom views is, well... very custom. It's impossible to predict how all custom views will work and accommodate for all of them.
Like I said, if your view has extra behavior on top of being rounded, I suggest extending or forking this library to reuse the code, otherwise supporting arbitrary custom drawables and views is not the aim of this library.
from roundedimageview.
Snapshot build does round the corners for us on color drawables. Once it's officially released we'll switch to using it.
Thanks!
from roundedimageview.
Cool, there are still some bugs I can't seem to hunt down (see example app), but if it works for most cases I'll push up the new version now.
from roundedimageview.
@vinc3m1 I fully agree on your points about limited features support and forking, the only problem is that you realize limitations only after the first run and spend useless efforts on adding library to your project.
from roundedimageview.
Related Issues (20)
- convert drawble image to bitmap HOT 1
- How can I display a gif??? HOT 2
- Fatal Exception: java.lang.OutOfMemoryError HOT 2
- TransitionDrawable support
- Out of Memory Error in resolveBackgroundResource HOT 1
- ImageView on top of roundedimageview HOT 1
- Losing Fade-in Animation when used with Picasso HOT 1
- <com.makeramen.roundedimageview.RoundedImageView xmlns:app="http://schemas.android.com/apk/res-auto" android:id="@+id/imageView1" android:src="@drawable/photo1" android:scaleType="fitCenter" app:riv_corner_radius="30dip" app:riv_border_width="2dip" app:riv_border_color="#333333" app:riv_mutate_background="true" app:riv_tile_mode="repeat" app:riv_oval="true" /> HOT 1
- Could not resolve com.makeramen:roundedimageview:2.3.0.
- RoundedImageView设置ScaleType=ScaleType.FIT_XY时,图片显示不出的效果,没有进行拉伸。用ImageView是正常的。
- RoundedImageView not working Glide transition animation and rounded corner broken! HOT 1
- LinearLayout使用layout_weight属性的bug HOT 1
- Display error when layout change caused by screen rotation
- android:scaleType Not working in new version HOT 3
- cannot show gif HOT 1
- Conflict with Glide .transition(DrawableTransitionOptions.withCrossFade) HOT 2
- Fatal Exception: java.lang.OutOfMemoryError HOT 1
- 控件设置android:tint 属性对图片着色没有效果
- cannot show gif. How can I fix that? HOT 3
- Will your library supprot OpenHarmony platform by JavaScript language? HOT 1
Recommend Projects
-
React
A declarative, efficient, and flexible JavaScript library for building user interfaces.
-
Vue.js
🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.
-
Typescript
TypeScript is a superset of JavaScript that compiles to clean JavaScript output.
-
TensorFlow
An Open Source Machine Learning Framework for Everyone
-
Django
The Web framework for perfectionists with deadlines.
-
Laravel
A PHP framework for web artisans
-
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.
-
Visualization
Some thing interesting about visualization, use data art
-
Game
Some thing interesting about game, make everyone happy.
Recommend Org
-
Facebook
We are working to build community through open source technology. NB: members must have two-factor auth.
-
Microsoft
Open source projects and samples from Microsoft.
-
Google
Google ❤️ Open Source for everyone.
-
Alibaba
Alibaba Open Source for everyone
-
D3
Data-Driven Documents codes.
-
Tencent
China tencent open source team.
from roundedimageview.