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
follow these steps
create a drawable folder in res directory.(if not present)
right click on drawable folder> New > Drawable resource file
Give your file a name and change the root element to shape.
(its selector by default)
now you are good to go.
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.
Right Click On drawable folder
Select New -> XML -> Layout File
Type Root Element shape
Related
According to the Android Studio first app tutorial, there should be a folder in the res called layout folder and inside that folder > activity_my.xml file.
My res folder does not contain the layout folder, it has drawable, mipmap, and value folders.
I have attempted restarting the program and creating multiple new projects.
Right click on resource folder and create new directory with layout name and put your xml in it . i hope your problem solved .
Right click on res folder and create new directory with layout name and put ur XML in it . hope ur problem solved .
Don't create in drawable folder , create in res folder or another way is to cut your layout directory and paste in res folder
I have encountered the following issue in Android Studio: when I select the "..." to specify the source drawable file for an ImageView, in the Project tab I don't see the project drawables, even if they do appear into the drawable folder on the left pane, but instead a long list of (I guess) system drawables (whose name is starting with "abc_") and no trace of the custom files I have successfully pasted into the project drawable folders.
If I try to write manually a reference to the correct resource in XML (android:src="#drawable/main_title"), I get the following error popup:
Rendering Problems Couldn't resolve resource #drawable/main_title. Failed to convert #drawable/main_title into a drawable.
Does anybody have any idea of what's happened? Thank you in advance.
You're trying to put in android:src a string, not a Drawable. If you want to apply drawable to your ImageView src you should use somthing like this:
android:src="#drawable/your_image_drawable"
I just found my own mistake: I pasted the drawable files inside the drawable folder, while they must reside inside the res folder. Now it works.
Thanks for your replies.
I am trying to do an android app, with this tutorial: http://developer.android.com/training/basics/actionbar/styling.html#CustomTabs
In link he says: create res/drawable/actionbar_tab_indicator.xml file,
but when I am looking to drawable folder there is only five folders:
Where do I put the actionbar_tab_indicator.xml file?
Make new folder named 'drawable' in app\src\main\res
Then put your actionbar_tab_indicator.xml file there.
I have this custom xml file. I would parse it later.
The problem is where to put it. I used eclipse adt.
I created a new folder in the resources. I named it "xml".
After that i tried to create a XML file in the folder.
Right clicked the xml folder>new>android xml file
Then the window pops. I change the folder to res/xml but when I clicked the finish button nothing happens. Can you help me with this? Thanks.
Clean all your projects.
Update your ADT.
If its not the layout file, place it in asset folder
<AppName>/assets/
If you create android xml then that should be created in layout folder and extends any of android layout or controls.
For creating custom xml file, right click on res/xml folder --> new --> file and enter your filename.xml
Don't forget to add extention .xml
this might sound silly. i am trying to do tab layout for android.
there is a part where i need to create a drawable folder and have android xml file in that particular folder.
i have looked into all the tutorial and youtube for this. The tutorial shows create a new android xml file and choose Drawable for the type of the resources.
in my case, i cannot create new android xml file with Drawable as the type of resources as Drawable does not exist. Below shows the interface.
is there anyway can help me with this? i also tried to add the resource manually but it wont work.
if i am creating a new android xml file with other resource type and force it to put in drawable folder, the application crash.
1. Go to your project explorer which should be on the left side of your eclipse IDE.
2. Right click the res folder of your project
3. Click new, then folder
4. Name that folder drawable
5. Right click your new drawable folder, click new
6. Search for XML File in the XML folder
7. ENJOY :)
I'm not sure if i understand exactly what you mean, Is this what you want to do? If so then the steps provided is how to do so, if you need me to clarify let me know.
Do the following,
your project -> new -> Folder -> write drawable in the text box -> finish
So, drawable folder is now created in res folder.
Then,
drawable -> new -> File -> enter the name of the xml file you want to create (ex. test.xml)
OR
drawable -> new -> Android XML File -> enter the name of the xml file you want to create (ex. test)
Now you can see there is a .xml file in your drawable folder. Now you do whatever you like to do with this .xml file.
#Sara if you have successfully created your extra "drawable" folder, right click on the new "drawable" folder and go to new Android XML File, just name the new xml file and finish next.