Android detect which layer is clicked on VectorDrawable

You can post your problem related to Computer Software Projects here. We will try our best to help you out.
Post Reply
Vazquez
Posts: 30
Joined: Mon Mar 06, 2017 8:50 am

Android detect which layer is clicked on VectorDrawable

Post by Vazquez » Thu Mar 09, 2017 8:52 am

I have an SVG file which looks like

Image

When converted through Android Vector Studio, the xml looks like

Code: Select all

<vector xmlns:android="http://schemas.android.com/apk/res/android"
    android:width="580dp"
    android:height="400dp"
    android:viewportWidth="580.0"
    android:viewportHeight="400.0">
<path
    android:name="someName"
    android:pathData="M0,30a30,30 0,1 0,60 0a30,30 0,1 0,-60 0z"
    android:strokeColor="#000"
    android:fillColor="#fff"
    android:strokeWidth="1.5"/>
<path
    android:name="someOtherName"
    android:pathData="M60,100a40,40 0,1 0,80 0a40,40 0,1 0,-80 0z"
    android:strokeColor="#000"
    android:fillColor="#000"
    android:strokeWidth="1.5"/>
</vector>
When any of the circles or paths of this vector are clicked, I want to know which layer or circle has been clicked. I could not find any method which will let me know that there are two layers or which layer has been clicked.

From this answer it looks like getting inner elements of a VectorDrawable is not possible. So is there any way I can get to know exactly which circle/layer is clicked?

Post Reply