I am trying to create a custom ImageView that Shows images inside a custom border and shape instead of default rectangle, and out Side of The Borders are TransParent.
my border is an SVG File, How I can do this? thanks
I am trying to create a custom ImageView that Shows images inside a custom border and shape instead of default rectangle, and out Side of The Borders are TransParent.
my border is an SVG File, How I can do this? thanks
Use this library siyamed/android-shape-imageview or create a custom view that extend from View class and override methods!
But the easiest way is using this library
create a bitmap that you want to mask your original picture and use this like below :
<com.github.siyamed.shapeimageview.mask.PorterShapeImageView
android:layout_width="match_parent"
android:layout_height="match_parent"
android:layout_weight="1"
android:layout_margin="8dp"
app:siShape="@drawable/octogon" <!--mask bitmap-->
android:src="@drawable/neo" <!-- original bitmap -->
app:siSquare="true"/>
Extend the Image View class and change it according to your use. Not just Image View you can customized any view class you just need to extend parent class.