pungrue26 / selectableroundedimageview Goto Github PK
View Code? Open in Web Editor NEWAndroid ImageView that supports different radii on each corner.
Android ImageView that supports different radii on each corner.
BitmapDrawable db = (BitmapDrawable) pic.getDrawable();
if (db != null)
return db.getBitmap();
return null;
if crashing
Glide.with(context)
.load(POST_IMG)
.transition(DrawableTransitionOptions.withCrossFade())
.into(img_thumbnail);
}
with out transition working fine
android.graphics.drawable.TransitionDrawable cannot be cast to com.joooonho.SelectableRoundedImageView$SelectableRoundedCornerDrawable
app:sriv_left_bottom_corner_radius not curving
java.lang.ClassCastException: android.graphics.drawable.TransitionDrawable cannot be cast to com.gongpingjia.view.SelectableRoundedImageView$SelectableRoundedCornerDrawable
at com.gongpingjia.view.SelectableRoundedImageView.updateDrawable(SelectableRoundedImageView.java:201)
at com.gongpingjia.view.SelectableRoundedImageView.setImageDrawable(SelectableRoundedImageView.java:149)
Hi,
Do we have any feature to use overlay color or image on clicking on the image?
SimpleTarget target = new SimpleTarget<GlideBitmapDrawable>() {
@Override
public void onResourceReady(GlideBitmapDrawable resource, GlideAnimation glideAnimation) {
selectRoundIv.setImageBitmap(resource.getBitmap());
}
};
Glide.with(context).load(path).into(target);
This is my code for loading url image. The "selectRoundIv" is the object of SelectableRoundedImageView. It seems worked. But when I set scaleType with centerCrop, there's a problem. The image cannot be showed, or be showed without corners.
This is the effect of this issue. By the way, the top imageview' url and the top selectableRoundImageView's url are the same.
And this is the effect which is image be showed without cornors.
<android.support.v7.widget.CardView xmlns:android="http://schemas.android.com/apk/res/android"
xmlns:app="http://schemas.android.com/apk/res-auto"
xmlns:tools="http://schemas.android.com/tools"
android:id="@+id/news_card_view"
android:layout_width="match_parent"
android:layout_height="68dp"
app:cardBackgroundColor="#3f3f3f"
app:cardCornerRadius="8dp"
app:contentPadding ="0dp"
app:cardPreventCornerOverlap="false">
<com.joooonho.SelectableRoundedImageView
app:sriv_left_top_corner_radius="8dp"
app:sriv_right_top_corner_radius="0dip"
app:sriv_left_bottom_corner_radius="8dp"
app:sriv_right_bottom_corner_radius="0dp"
android:background="@drawable/news_image_bg"
android:id="@+id/pic"
android:layout_width="68dp"
android:layout_height="68dp"
android:layout_marginRight="@dimen/default_padding"
android:scaleType="centerCrop" />
</android.support.v7.widget.CardView>
when i do like this ,cardview's shape is rectangle
On Api 28 doesnt work right
Glide.with(getContext())
.load(imageUri))
.placeholder(R.drawable.abc)
.into(imageView);
java.lang.ClassCastException: android.graphics.drawable.TransitionDrawable cannot be cast to com.joooonho.SelectableRoundedImageView$SelectableRoundedCornerDrawable
在ListView里面,我使用的图片加载工具是 novoda-image-loader 但是我更希望SelectableRoundedImageView做一些修改,因为使用Aquery加载图片也会有相同的问题。
public class GridAdapter extends BaseAdapter {
private List<NaiFen> data;
private Context c;
public GridAdapter(Context c, List<NaiFen> dataList) {
this.c = c;
this.data = dataList;
}
@Override
public int getCount() {
return 20;
}
@Override
public Object getItem(int arg0) {
return null;
}
@Override
public long getItemId(int arg0) {
return 0;
}
@Override
public View getView(int position, View convertView, ViewGroup parent) {
ViewHolder holder;
if (null == convertView) {
holder = new ViewHolder();
convertView = LayoutInflater.from(c).inflate(
R.layout.grid_item_layout, null);
holder.img = (SelectableRoundedImageView) convertView.findViewById(R.id.img);
holder.title_tv = (TextView) convertView
.findViewById(R.id.title_tv);
holder.price_tv = (TextView) convertView
.findViewById(R.id.price_tv);
holder.flag_img = (ImageView) convertView
.findViewById(R.id.flag_img);
holder.old_price_tv = (TextView) convertView
.findViewById(R.id.old_price_tv);
convertView.setTag(holder);
} else {
holder = (ViewHolder) convertView.getTag();
}
holder.old_price_tv.getPaint()
.setFlags(Paint.STRIKE_THRU_TEXT_FLAG);
loadBigImage(item.getPic_url(), holder.img);
return convertView;
}
static class ViewHolder {
SelectableRoundedImageView img;
TextView title_tv;
ImageView flag_img;
TextView price_tv;
TextView old_price_tv;
}
protected void loadBigImage(String url, ImageView view) {
view.setTag(imageBigTagFactory.build(url, c));
imageBigManager.getLoader().load(view);
}
}
i want to have a cardview with imageview in top of card, while the image includes a Textview and chexbox in it.
how can i do that?
SelectableRoundedImageView$SelectableRoundedCornerDrawable.drawableToBitmap(SelectableRoundedImageView.java:387)
SelectableRoundedImageView$SelectableRoundedCornerDrawable.fromDrawable(SelectableRoundedImageView.java:364)
SelectableRoundedImageView.setImageDrawable(SelectableRoundedImageView.java:145)
Loading gif through glide loads only still image
If you take a lot of code and name your library after someone else's, at least thank them.
Why define a new ScaleType which value is limited in the same of Android ImageView?
My selectableRoundedImageView occasionally lead to picture displaying 1/4 when i use it with Glide.
i use it in my application.
` my code
public void loadNormal(@NonNull SelectableRoundedImageView imageView, @NonNull Object url, int widthDp, int
heightDp, int placeholder) {
RequestOptions requestOptions = new RequestOptions()
.diskCacheStrategy(DiskCacheStrategy.RESOURCE);
if (placeholder != -1) {
requestOptions.placeholder(placeholder).error(placeholder);
}
if (widthDp > 0 && heightDp > 0) {
requestOptions.override(DeviceUtils.dip2px(imageView.getContext(), widthDp),
DeviceUtils.dip2px(imageView.getContext(), heightDp));
} else if (widthDp > 0) {
requestOptions.override(DeviceUtils.dip2px(imageView.getContext(), widthDp));
}
Glide.with(imageView.getContext())
.load(getPath(url, imageView))
.thumbnail(0.6f)
.apply(requestOptions)
.into(imageView);
} `
i have did nothing with it but used glide.
Why not upload the library to maven, so we can use with gradle
Do not show
it is giving out of memory exception some time
经过测试发现,放在一个正方形容器不写死高宽,导致某些图形扭曲,能否修复?
A declarative, efficient, and flexible JavaScript library for building user interfaces.
🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.
TypeScript is a superset of JavaScript that compiles to clean JavaScript output.
An Open Source Machine Learning Framework for Everyone
The Web framework for perfectionists with deadlines.
A PHP framework for web artisans
Bring data to life with SVG, Canvas and HTML. 📊📈🎉
JavaScript (JS) is a lightweight interpreted programming language with first-class functions.
Some thing interesting about web. New door for the world.
A server is a program made to process requests and deliver data to clients.
Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.
Some thing interesting about visualization, use data art
Some thing interesting about game, make everyone happy.
We are working to build community through open source technology. NB: members must have two-factor auth.
Open source projects and samples from Microsoft.
Google ❤️ Open Source for everyone.
Alibaba Open Source for everyone
Data-Driven Documents codes.
China tencent open source team.