![](https://blogger.googleusercontent.com/img/b/R29vZ2xl/AVvXsEi6I6f8-iT91qyiSNSvWjQElIpletgPbr1wW1kpjIcKTWaoV1FRD5b1HGHF_8o2Q_pVNzdd_4LgPJH1v-QpgmtQdFIl3pLm3JzjoPGcN4lfdjLZzPgPkoTexnpjJ1CYqBCgrpSa1DhQ-g/s320/device-2019-06-21-094927.png)
It is possible to extend the drawer by code to display non-rectangular icons but I prefer to adjust the SVG icon instead. The way I did it was to change the page size to a square and then placing a transparent square box around the page. The following steps illustrate:
Change the page to a square
- Open up the SVG icon in Inkscape.
- Select File | Document Properties.
- Under the Page tab, change the Width and Height to be equal e.g. 1200 x 1200 px. Close the dialog box.
The page display changes to a square. - Using the Align and Distribute tools, align the graphics to the middle of the page.
- Next, click the Create rectangles and squares (F4) icon. Place a stroke only, no-fill rectangle on the page.
- Change the width and height of the rectangle to match the page dimensions e.g. 1200 by 1200 px.
- Change the origin to the upper left corner of the page, e.g. X=0, Y=0.
- Open the Fill and stroke pane. Change the stroke opacity to low or zero opacity, e.g. 0.
- Save the file.
- In Android Studio, right click on the /path/to/app/res/drawables folder and choose New | Vector Asset.
- Toggle on Local File (PNG, SVG). Choose the new SVG icon file from the previous section.
- Click Next. Click OK.
The drawable is created.
![](https://blogger.googleusercontent.com/img/b/R29vZ2xl/AVvXsEioqQMORteEy-_7wDfp9A3N2nhVNp6wvkHF313mC3DYU7fGLXHTzIlIeSaoKil_pSoCTrHcRRPHoRYzwRmboZijDh9zdHM1PRr-HgcHNeYFJ0MD4T-QxgHA3bOXLPb0qqX1_nFr-3gPYQ/s320/device-2019-06-21-102923.png)
No comments:
Post a Comment