I want to create a hexagon shape button in android so that it's touch area does not overlaps (on the right) ie.I want heaxagon touch bound not a rectangle touch bound. I tried to use image view but it does not excludes tranparent(shown in blue, left). Is there any clickable object which is defined by xml shape/path. please can anyone show me xml shape/path part for just one button if its possible or any other method.
check out this
<com.github.siyamed.shapeimageview.{ClassName}
android:layout_width="match_parent"
android:layout_height="match_parent"
android:layout_margin="8dp"
android:src="@drawable/neo"
app:siBorderWidth="8dp"
app:siBorderColor="@color/darkgray"/>
Attributes:
siBorderColor
border colorsiBorderWidth
border width in dp
siBorderAlpha
alpha value of the border between 0.0-1.0
siStrokeCap
border stroke cap type butt|round|squaresiStrokeJoin
border stroke join type bevel|miter|roundsiSquare
set width and height to the minimum of the given values
true|falsesiShape
a reference to an SVG. This is used by ShapeImageView, not
the subclasses of it.There's no system view that would do custom shapes for you. You need to create custom view: http://developer.android.com/training/custom-views/index.html and in its onTouchEvent()
determine if user's tap is inside or outside clickable area and act accordingly.
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With