create shape xml file in drawable folder in android studio

瘦欲@ 提交于 2019-11-30 21:46:25

问题


I am using Android studio 1.2.2 and need to know how to create a new shape file in drawable folder. I have already done the same in Eclipse but unable to do so in the android studio 1.2.2


回答1:


follow these steps

  1. create a drawable folder in res directory.(if not present)

  2. right click on drawable folder> New > Drawable resource file

  3. Give your file a name and change the root element to shape. (its selector by default)

now you are good to go.




回答2:


I was confused by the post from Anirudh when he said to change the root element to shape. But here is full demo.

Basically, the shape element is not provided by drawable resource file list by default. So just create one and then change the root xml element to shape, manually.




回答3:


  1. Right Click On drawable folder
  2. Select New -> XML -> Layout File
  3. Type Root Element shape


来源:https://stackoverflow.com/questions/31468454/create-shape-xml-file-in-drawable-folder-in-android-studio

易学教程内所有资源均来自网络或用户发布的内容,如有违反法律规定的内容欢迎反馈
该文章没有解决你所遇到的问题?点击提问,说说你的问题,让更多的人一起探讨吧!