1

I was searching in the internet and did not find a solution for such xml drawable.

Simply I want to create such horizontal arrow with two heads https://cdn4.iconfinder.com/data/icons/universal-3-2/16/143-512.png. How to do that in xml?

Thank you everybody for help.

  • 2
    Personally, I would use an SVG editor like Inkscape, create the desired image, save the SVG, then import it as a vector drawable. – CommonsWare Dec 31 '22 at 15:50

1 Answers1

0

This kinda thing?

<vector xmlns:android="http://schemas.android.com/apk/res/android"
    android:width="24dp"
    android:height="24dp"
    android:viewportWidth="24"
    android:viewportHeight="24">
  <group android:scaleX="0.046871338"
      android:scaleY="0.046871338">
    <path
        android:pathData="M508.93,248.35L402.27,141.69c-4.27,-4.05 -10.99,-3.95 -15.04,0.21c-3.95,4.16 -3.95,10.67 0,14.83l88.43,88.43H36.4l88.43,-88.43c4.05,-4.27 3.95,-10.99 -0.21,-15.04c-4.16,-3.95 -10.67,-3.95 -14.83,0L3.12,248.35c-4.16,4.16 -4.16,10.88 0,15.04L109.79,370.06c4.27,4.05 10.99,3.95 15.04,-0.21c3.95,-4.16 3.95,-10.67 0,-14.83L36.4,266.59h439.15L387.12,355.02c-4.27,4.05 -4.37,10.88 -0.21,15.04c4.05,4.27 10.88,4.37 15.04,0.21c0.11,-0.11 0.21,-0.21 0.21,-0.21l106.67,-106.67C513.09,259.34 513.09,252.51 508.93,248.35z"
        android:fillColor="#000000"/>
  </group>
</vector>

double ended arrow xml

For the future (or if you want something slightly different), here's how to get it:

  1. Find an SVG with appropriate licensing (one linked above is CC0).
  2. Download it.
  3. Import the SVG, it'll be converted to an XML drawable automatically.
Jake Lee
  • 7,549
  • 8
  • 45
  • 86
  • Thank you! Its great but would it be possible to remove vertical padding to full the whole space? –  Jan 01 '23 at 11:29