siyamed / android-shape-imageview Goto Github PK
View Code? Open in Web Editor NEWCustom shaped android imageview components
License: MIT License
Custom shaped android imageview components
License: MIT License
Is there a way to set siBroderColor, siBorderWidth and siShape via setter methods in Java?
It seems that i can't make my hexagon corners go round
<com.github.siyamed.shapeimageview.HexagonImageView
android:layout_width="@dimen/profile_picture_size"
android:layout_height="@dimen/profile_picture_size"
android:src="@drawable/neo"
app:siBorderWidth="10dp"
app:siBorderColor="@color/blue"
app:siRadius="10dp"
android:layout_alignParentTop="true"
android:layout_centerHorizontal="true"
android:id="@+id/view_profile_pic"
android:scaleType="centerCrop"/>
Am I doing it wrong?
Hi,
I'm using Glide to load an image to your DiamondImageView and it show as square. But it work well with Picasso. So, without using Picasso do you have any hint for it?
In my layout i using CircularImageView :
////-------
--- com.github.siyamed.shapeimageview.CircularImageView
android:id="@+id/imgShow"
android:layout_width="64dp"
android:layout_height="64dp"
android:src="@drawable/photo"/ // set my image (photo.jpg 88x88 px)
i habe a result :
it remains straight line in four edge of image. i dont know why . i try to fix but dont
I was using your library and i found this very useful . I am making an app where i want to add a functionality for drag ,zoom image within the imageview . I have tried to implement that functionality but couldn't help myself . I was wondering if you could do something
I want to read source codes of this project. But settings are too old to succeed opening the project. So could you update them? Thanks for your contribution.
Error:(222) No resource identifier found for attribute 'borderWidth' in package 'com.app.demo'
Error:(222) No resource identifier found for attribute 'borderAlpha' in package 'com.app.demo'
Error:(222) No resource identifier found for attribute 'borderColor' in package 'com.app.demo'
Please check, also Let me know if some thing needs to be done from my end to fix these
👍 for the great library
Hi,nice work.I know this is off-topic but would it be possible to create an hexagon textview using same principles? I need an hexagon with borders and transparent background as the background of android textview...Thanks...
hi,
great library thanks for all of it. I have an issue when I try to use your roundedimageview view. This is my xml define :
<com.github.siyamed.shapeimageview.RoundedImageView
android:id="@+id/iv_message_image"
android:layout_width="250dp"
android:layout_height="match_parent"
android:contentDescription="@string/app_name"
android:scaleType="fitXY"
app:siRadius="11dp"
app:siBorderWidth="2dp"
android:padding="1dp"
app:siBorderColor="@color/chat_bubble_green"
app:siSquare="true"
android:src="@drawable/profile" />
In the top layout I have a linearlayout which has a 9 png as background. Anyway this implementation is in a recyclerview. And some items in that view some of the roundedimageview's side have black line. This is what I want to mean :
Any ideas? Thanks...
Hi,
I have a problem when setting image from a phone gallery. It doesn't change orientation of the image. I tried changing bitmap orientation programmatically, but nothing happened.
Here is my code:
Uri selectedImage = data.getData();
String[] filePathColumn = { MediaStore.Images.Media.DATA };
Cursor cursor = getActivity().getContentResolver().query(selectedImage,
filePathColumn, null, null, null);
cursor.moveToFirst();
int columnIndex = cursor.getColumnIndex(filePathColumn[0]);
selectedImagePath = cursor.getString(columnIndex);
cursor.close();
avatar.setImageBitmap(BitmapFactory.decodeFile(selectedImagePath));
This is the xml:
<com.github.siyamed.shapeimageview.RoundedImageView
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:src="@drawable/avatar"
app:siRadius="100dp"
app:siBorderWidth="0dp"
app:siBorderColor="#666"
app:siSquare="true"
android:id="@+id/imageViewAv"
/>
This is just a preview of a profile photo.
Thanks,
Jovan
This is what I get for this code:
final CircularImageView imageView = (CircularImageView) findViewById(R.id.image);
new Handler().postDelayed(new Runnable() {
@Override
public void run() {
imageView.setBorderWidth(4);
imageView.setBorderColor(0xff000000);
imageView.setImageResource(R.drawable.landscape);
}
},1000);
<LinearLayout
xmlns:android="http://schemas.android.com/apk/res/android"
xmlns:tools="http://schemas.android.com/tools"
android:layout_width="match_parent"
android:layout_height="match_parent"
android:gravity="center"
android:orientation="vertical"
android:paddingBottom="@dimen/activity_vertical_margin"
android:paddingLeft="@dimen/activity_horizontal_margin"
android:paddingRight="@dimen/activity_horizontal_margin"
android:paddingTop="@dimen/activity_vertical_margin"
tools:context="com.example.user.myapplication.MainActivity">
<com.github.siyamed.shapeimageview.CircularImageView
android:id="@+id/image"
android:layout_width="100dp"
android:layout_height="100dp"/>
<ImageView
android:id="@+id/original"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:layout_marginTop="4dp"
android:background="#3300ff00"
android:src="@drawable/landscape"/>
</LinearLayout>
It's using a fixed width and height, but in the editor it has width/height of 0. At runtime, it has width/height of 0 until it draws something. This is a problem because it's in a RelativeLayout and other views are aligned to it, which makes them shift in front of you.
I looked at the onMeasure code and I can't see why this happens.
I am settings its content with Picasso, but that shouldn't matter - the size is fixed so it should never be getting resized.
<com.github.siyamed.shapeimageview.CircularImageView
android:id="@+id/user_photo_image_view"
android:layout_width="66dp"
android:layout_height="66dp"
/>
My workaround is to put it inside of a LinearLayout that has a fixed size.
Siyamed, thank you for great library. I would love to use in my project but I have a small problem with your license.
Apache License 2.0 standard legal line typically begins with:
Copyright {yyyy} {name of copyright owner}
In the case of your Android-ShapeImageView, only the subsequent “Licensed under the Apache License, Version 2.0 ...” is listed without any copyright owner preceding it.
Would you mind adding your copyright information to it?
thank you,
Janusz
i want to change shape for PorterShapeImageView programatically? how do i do so?
Some images with shape are not displayed on the Android API level 15.
For example: HeartImageView, HexagonImageView does not work, but with CircularImageView works.
<com.github.siyamed.shapeimageview.CircularImageView
android:layout_width="48dp"
android:layout_height="48dp"
android:src="@android:drawable/sym_def_app_icon"
app:siBorderWidth="2dp"
app:siBorderColor="#fff"
android:id="@+id/imgUsuario" />
Try setting this:
<com.github.siyamed.shapeimageview.CircularImageView
android:id="@+id/image"
android:layout_width="100dp"
android:layout_height="100dp"
android:src="@drawable/landscape"
app:siBorderWidth="0px"/>
It will still show a border.
Even when I set app:siBorderColor="#00000000" , it still appears...
Loving this project!
Can't seem to build an APK if proguard is turned on though. Tried different -dontwarn schemes, but to no avail. Any ideas? Seems related to the kXML?
is it possible to make si square true give the max height or width rather than the minimum,
thanks for your library it works well for my requirement other than sometimes part of my image is cut off, changing si square to look for the max would fix this, you could then offer a color the background should be inside the empty space
I run the sample code and find out that all svg-based ImageView can't be displayed on Samsung GT-N7100 and GT-I9100G. I don't have many handsets to test but those are the only handsets with the issue.
I am integrating this library into a commercial project and I am trying to figure out the cause. It's important for me to resolve the issue.
Porter Image View works but not the Rounded Image View
Glide.with(this.activity).load(R.drawable.party).into(view.iconView);
How exactly does it work? Does it create a new bitmap for each time I set an image?|
I have an image with scaletype centerInside but isn't working, i have this:
<com.github.siyamed.shapeimageview.PentagonImageView
android:layout_width="match_parent"
android:layout_height="75dp"
android:src="@drawable/restaurant"
android:scaleType="centerInside"
/>
The shape works however no borders are showing up
<com.github.siyamed.shapeimageview.HexagonImageView
android:id="@+id/img_circle"
android:layout_width="40dp"
android:layout_height="40dp"
android:src="@drawable/pub"
app:siBorderWidth="6dp"
app:siBorderColor="@color/colorPrimaryDark"/>
Hello.
Zoom In/out not working. what should be wrong?
Same code working with normal ImageView.
I using Picasso to load image from network and display on CircularImageView. code :
Picasso.with(mContext).load(feedItem.getUrlImgShow())
.error(R.drawable.sample_2)
.placeholder(R.drawable.placeholder)
.into(myViewholder.thumbnail);
Aber it dont load image. i reading in Sample. you creat the Contructor in Adapter class with Picasso .
private Adapter(Context context, Picasso picasso, int layout) {
super(context, 0);
this.picasso = picasso;
this.layout = layout;
}
aber i dont. Creat picasso in Adapter Contructor,it is mandatory(required )
Your library is very useful. Thank You.
The version as seen in the below statement is 0.9+ and android studio throws a warning for such statements.
compile 'com.github.siyamed:android-shape-imageview:0.9.+@aar'
Can you tell me whats the new version is ??
Hello,
First of all great library, thank you. I think you have a memory leak in your code that is causing OutOfMemory errors. I have added these lines of code in the PorterImageView class and they are gone now. I'm not really sure if they are all needed.
@Override
protected void onDetachedFromWindow()
{
super.onDetachedFromWindow();
if (maskBitmap != null && !maskBitmap.isRecycled()) maskBitmap.recycle();
if (drawableBitmap != null && !drawableBitmap.isRecycled()) drawableBitmap.recycle();
}
private void createMaskCanvas(int width, int height, int oldw, int oldh)
{
...
Bitmap oldBitmap = maskBitmap;
maskBitmap = Bitmap.createBitmap(width, height, Bitmap.Config.ARGB_8888);
if (oldBitmap != null && oldBitmap != maskBitmap && !oldBitmap.isRecycled()) oldBitmap.recycle();
maskCanvas.setBitmap(maskBitmap);
...
oldBitmap = drawableBitmap;
drawableBitmap = Bitmap.createBitmap(width, height, Bitmap.Config.ARGB_8888);
if (oldBitmap != null && oldBitmap != drawableBitmap && !oldBitmap.isRecycled()) oldBitmap.recycle();
drawableCanvas.setBitmap(drawableBitmap);
...
}
}
hi dear,
I want libery android-shape-imageview import into eclipse
but i cant.i want just diamond shape image view
Is it possible for me to put diamond class ????
is that possible to support the following:
android:background="@drawable/shape_circle"
shape_circle is the shape that defined in xml file.
So that I can set it on a normal ImageView (even as the background of it) and it will work.
Is it possible to combine this with the Volley NetworkImageView? I would like to pull my images from url's or json but have them take the shape of my svg/shape once loaded. Is this possible or can it be done? I tried combining the two classes into one class but it didn't work. I think the way ShapeImageView and NetworkImageView set/load the image(s) is different. Trying to figure this out but would appreciate any help. I'm sure this idea/concept would come in very handy for a lot of other people. Thanks in advance for any reply.
Hi, I am trying to add the aar using gradle as below
compile 'com.github.siyamed:android-shape-imageview:0.9.+@aar'
upon using find tool I found that radius is already used my ViewPagerIndicator, because of which I am unable to add the library.
Is there any workaround to change the attrs name so that I can add it into my project?
ShapeImageView's drawable is not not rotating using postRotate(). How can i achieve that ?
Please help me. . .
I would like to rotate hexagon shape for my design. You can just consider your svg that rotates 90 angle. How can I make this? Please help me....
any idea on how to integrate this with Android Volley NetworkImageVIew?
Thanks
Any plans to add setSiShape
as a programmatic option for Bitmap Mask Based ImageViews specifically PorterShapeImageView
? I see you added it via setShapeResId()
for ShapeImageView
in #24
com.github.siyamed.shapeimageview.shape.PorterShapeImageView
was changed to
com.github.siyamed.shapeimageview.mask.PorterShapeImageView
please update README.
Thx.
It just doesn't do anything.
Not via code, and not via XML ... how come?
When I used ithe CircularImageView in the RelativeLayout, I found I can't define the size of the view with fixed dp which work well in the LinearLayout. Can't it be fit?
i want add rounded corners in PentagonImageView
That library was really great! Can you support "siArrowPosition" support "top" and "bottom" attributes
Thank you for your time write this!
How to use BubbleImageView with rounded corners ?
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.