1

Could you please help me draw this shape as one xml file:

The thing is, I would like to have it as one drawable xml shape to be used as a background image.

Please help.

enter image description here

OneCricketeer
  • 179,855
  • 19
  • 132
  • 245
  • 1
    Use a ninepatch drawable or a vector drawable instead. You could do it in a layer-list but it will be a fragile implementation as you will need to know the exact dimensions of the View where the layer-list will be used. – user Jan 31 '17 at 09:58
  • @Luksprog a ninepatch is impossible for me. I don't even understand how the clicking helps. Do you have any sample code for a vector drawable? If you can post it as an answer I'll gladly accept it – iOSAndroidWindowsMobileAppsDev Jan 31 '17 at 13:27
  • 1
    By vector drawable I meant drawing the image as a svg file(in external programs like Illustrator or inkscape) and then importing it in Android studio through the vector assets tool. You could also make a custom drawable and then manually drawing the lines an an arc. – user Jan 31 '17 at 14:22
  • @Luksprog Thanks. I managed to use the following hints: http://stackoverflow.com/questions/39607647/error-importing-vector-asset-into-android-studio/39608478#39608478 and http://stackoverflow.com/questions/35624562/code-analysis-error-unexpected-namespace-prefix-after-upgrading-android-suppor to create a vector drawable – iOSAndroidWindowsMobileAppsDev Feb 01 '17 at 09:49

1 Answers1

0

Not really an answer. Just stating that the problem was solved using a vector drawable:

Refs:

How to convert a PNG image to a SVG?

Error importing Vector Asset into Android Studio

Code Analysis Error (Unexpected namespace prefix) after upgrading Android Support Library 23.2.0

https://developer.android.com/studio/write/vector-asset-studio.html#svg

I tried importing the svg in Android studio through the vector assets tool but got numerous errors about the <svg tag not being declared and also an error about a sudden end of file.

The thing is you are not supposed to use *.svg files in android studio.

You have to convert a, e.g. png file to an svg file and the tool you use to convert the svg to a readable xml is svg2android. There is a minimum version for the gradle dependency and some configuration to be done in the app:build.gradle file. The app:srcCompat resource is not immediately recognisable which is why I provided the third link.

Shout out if you need further explanation.

Community
  • 1
  • 1