Where to put custom xml file? can't create - android

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

Related

Layout XML folder is missing in Android Studio

Problem:
layout XML folder is missing?
How to add it?
If the folder isn't there or wasn't added automatically when you created the project, you need to add it to your project in the following way:
Right-click on the res folder
Select New -> Android Resource Directory from the menu that opens
Select Resource type to be layout from the popup that opens
Click ok
Now you have added your layout folder, so you can now start adding XML files to this folder by the following steps:
Right-click on the layout folder
Select New -> Layout Resource File from the menu that opens
Enter your new file name
Click ok
Now you have a new XML file that you can use in any activity or fragment.
After open the layout resource file and which new file name, can be typed

Android Studio Tutorial Missing app/src/main/res/layout/activity_my.xml

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

how to create new android xml file in drawable folder that does not have Drawable resource

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.

How to see the Graphical Layout of an XML file in a folder within /res/layout?

I can see the Graphical Layout of the XML file within the /res/layout folder, but not the ones inside my /res/layout/signup folder. Does this mean I can only create XML layout files inside /res/layout? The other tab when I open the XML files in /res/layout/signup is "Structure," not "Graphical Layout." I'm using Eclipse, by the way.
Update: I tried moving the files from /res/layout/signup to /res/layout and now I can see their graphical layouts. So is this really a problem with the folders?
unfortunately /res/layout doesn't support child folders.
I'm pretty sure it's because R manages it's references as a List, and as such all layouts must be on the same "level".
Try appending what would be the folder as a prefix to the layout name--
signup_editform.xml
signup_tips.xml
...

how to create subfolder inside layout folder in Android and how to get id of layout which is inside of subfolder?

res/layout
---layout/subfolder1
---layout/subfolder2
is it right way to create sub folder inside layout folder in Android
and how to get id of layout from that sub folder.
Example:
res/layout
---layout/main.xml]
setContentView(R.layout.main);
You cant do that. I mean you can create folders if you want to but you can access them like "R.layout.sub1.layoutfile".
You can't do that. All you layout files must be in the root of the layout folder.
I don't think this is possible. yaa you may create folder for landscape layout. path will be :
res> layout-land (folder name)

Categories

Resources