How to create user defined folder in Android studio for example to create mylayout folder in res folder and Also to create xml file same name as i created in layout folder. mean duplicate file I want to create xml file with the same name but the message show to that xml file must be unique.
You can't do it, the only time you can create duplicate layout files is when they are within predefined folder names. res/layout-v14 for API 14+, res/layout-v21 for API 21+, etc and nowhere else.
Related
So I have tried creating new directories by right clicking the res folder then on new--> Android Resource Directory.Then I changed the Resource Type to drawable.
After doing all that I copied my images into this new directory that I have created and when I try to assign them to an imageview that was not assigned yet an image through the xml with the command android:src="#mydir/mypic" android studio does not recognise my custom folder name. Is this even possible?
I am using android studio 2.2.3
You can't create subfolders for drawables in the res/drawable folder.
See this question here in SO.
Can the Android drawable directory contain subdirectories?
#Aris I think it is possible to create multiple directories using gradle,
I read on mediumn about Android Project Structure - Alternative way
Please check this link,
https://medium.com/google-developer-experts/android-project-structure-alternative-way-29ce766682f0
Please read Conclusion carefully.
Thanks
I created a folder under res/xml. When I create a new xml file, xml does not show under resource type like the other resources under res. How can I make it appear?
Edit: I am using eclipse
If you mean the Dialog in eclipse with the Resource Type dropdown then know it's a static predefined dropdown. It won't have all possibilities or any special setup you are trying to achieve. You can simply create an xml file in the folder without having to drag it there.
Try create your xml inside layout folder and use R.layout.YourLayoutName and it should appear successfully
I always get a resource overwriting warning when I want to create a layout file BUT in different folder (for different configuration). I created a folder in lib directory as layout-port (for portrait orientation) and after right clicking the very same folder,If i wanna create a new file with the name of default xml layout file, it gives me the "file overwriting warning". WHY IS THAT? As far as I know I can use same file name in different resource folder.
I encountered this annoying situation too, it seems that even you selected layout-land to create the new file there, it still defaults to layout, so my workaround is to create the new file with a different name, for example main1.xml. Then I cut/paste the file from layout, into the layout-land.
In my android project, I have a folder called layout to store all xml files for layout, but there is also a folder inside called layout_settings
layout---->layout_settings--->about.xml
In my code
I have setContentView(R.XX.about). How do I set it such that reflect the about.xml inside layout_settings folder.
The reason I am doing is I don't want to scatter all the layout files into flat hierarchy.
No, you can't configure or modify a folder structure in android packages res/layout because they are read only file system.
The resources mechanism doesn't support subfolders in the layout directory, so you need to keep that hierarchy flat.
If you have to do like that just you can give a xml files name like, layout_setting.xml , layout_display.xml etc and use it.
I’m trying to create a roll over affect for my ImageButtons in my application I’ve been following the guide on the android developer’s site here’s the link
I’ve been trying to create the required XML drawable file which will change the image if it’s clicked but I’m unsure what type of xml file to create, whether it be animation, layout, value etc. When I go to create the file it forces you to select the type of file which stops you creating the xml in the drawable folder.
Does anyone know what typesof xml file I need to create?
In that case just don't select Android XML File in that list. Select Other and in the following list select XML File from the XML section. Give it an appropriate name and then just define what you need to define.