The picture above is my default project structure of Android Studio.
I want to add my own animation xml file to anim folder and use it.
So I try to create a folder called 'anim' but it says that folder already exists
But I can not see ... how can I 'see' and 'access' anim folder?
I found!
After switching to the 'Project' view from 'Android' view,
explore to the /res folder and right click and create directory called 'anim'!
Step 1 go to resource file and resource file
Right click on res folder of your app. Then click on "New". Now select "Android resource file". Pop up will open. Select Resource type as: Animation, Name your file and click OK. Here you go...Step 1
In Android Studio 4.0
Step 1:
Step 2:
Result
Its a bug in Android Studio. Try to refresh state by changing view type.
Anim is not default available in android project structure.
You need to create directory name it as anim.
res->new resource directoey.
Named it as anim.
Now for animation inside anim you can genrate xmls with respect of animation to use.
Refrence:
https://www.google.com/amp/s/www.androidhive.info/2013/06/android-working-with-xml-animations/amp/
I used this refrence ,I hope useful for others also.
Anim is for animation purpose,you can use name as per your wish,anim is just file name,purpose matters not name.
Don't worry just right click on RES then click on Show Explorer and you will go in res folder in desktop create manually folder anim in res folder then you ll use it.easily
If you not found anim directory file but you created
So, first you go in
windows-> user-> click on private user name->
AndroidStudioProject ->your project name-> res -> search anim file name and delete it..
Then you go to Android studio-> right click on res file ->new->Android Resource file-> write file name .xml->write anim name on directory name -> click ok
Thank you!
I am using Android Studio 3.4 and this is easy way follow these steps:
In Android Studio, right click on res folder
New > Android Resource Directory
Select anim for Resource Type
Done!
You can create your special ".xml" animation files.
right click on res file
click on New the click on Android Resource Directory
then on Resource Type select anim
click Ok
Related
enter image description hereI'm beginner to android studio . I downloaded code from this link :- https://github.com/jahirfiquitiva/Frames . In this code there is no activity_main.xml file . I want to place admob ads to this application . Can anyone help me to place admob ads to this "https://github.com/jahirfiquitiva/Frames" frames application .
Thanks in advance .
Please don't get confuse with library and actual applications.
https://github.com/jahirfiquitiva/Frames is a library that you can include into your project/app using gradle -
dependencies {
implementation('dev.jahir:Frames:3.3.0'#aar) {
transitive = true
}
}
After importing you can create your application and then you can put admod in your app's main layout file.
Edit (Missing Layout Folder)
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
After creating the res folder you can add layout folder as well
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 XML file you can use into you activity/fragment.
Please check this and this for more info.
Happy Coding !
Hi i wanted to make an assets folder but i have no option to do it , is it in another place , I've tried searching google but no results , also i tried installing tools in sdk manager with no luck , is there anything to do maybe i missed something ,btw im a beginner
i don't have file > new > folder
Thanks in advance .
In your screenshot, in the right-most fly-out menu, choose "Directory" to create a directory.
However, assets/ goes in src/. So, right-click over src/ for your desired source set, then choose File > New > Directory from the context menu.
In Android Studio, I need to use some resources (image, audio, etc...) from a folder different from the standard 'res',
Let's suppose that I have:
the '_Resources' folder containing the image 'aaa.png' .
the standard 'res' folder containing the image 'bbb.png'
I have put inside gradle file:
android {
sourceSets {
main.resources.srcDirs += 'C:/..../myLibrary/src/_Resources'
}
}
After that I see in Android window (top left of Android Studio) correctly both the standard 'res' folder and the 'resources' folder.
if I have to access to 'bbb.png' of 'res' standard folder, I use:
import com.myproject.R
.....
int xxx = R.drawable.bbb
THE QUESTION IS:
how can access now to aaa.png?
It is not seen in R. ; so I tried to import something else, but what?
Thank you in Advance
Fausto
This is not possible. If you define two png file with the same name in multiple resource folders android will load just one of them (not sure which one).
The name of them are actually their ID. And the concept of ID is sensful if its unique. So you cant do this.
Having multiple resource folders is just something to separate files and make everything more clear and better. Just foldering and nothing more.
for those that could have the same problem:
I didn't have success in accessing to resource folder, but I found another solution that fits my needs:
I added the '_Resources' folder in Assets, writing in gradle file:
main.assets.srcDirs += 'C:/..../myLibrary/src/_Resources'
then I get access in code to resources by:
AssetManager assetManager = getAssets();
InputStream myInputStream = assetManager.open("aaa.png");
That's all...
what I am trying to do is to create a new directory (styles) in res directory so that I can store all my styles there and can manage my codes easily from there. I have done it in Eclipse many times in the time of android development.
So, what I am doing is given in the pictures -
Step 1 -
Step 2-
Step 3-
Step 4-
But the problem is the the new moved directory is created (it is seen from the top navigator - red marked), but it is not shown in the left navigator and the file shows error.
If I try to add a new directory, it also not showing the file directory in the left. So, I can't create a new directory in any way in res directory.
Is there any way to create a new directory what can be used in codes for managing codes in res directory or it is not supported in Android Studio?
Can anyone help me please?
At the left pane, you have a dropdown near the top in which you've currently selected Android. Click on it and select Project. Then you can see the entire directory structure with all your folders. Navigate to your res folder and create new directory like follows. Your project > app > src > main > res > Right Click > New > Android Resource Directory
#Abrar Jahin, The answer by Bidhan A is the correct one. All you have to do for creating a new directory view from android to Project. Below the toolbar like CustomListView->App->.... You can see a tab saying Android click on it. There will be many options like Project, Packages, etc. Select Project, now you will get a entire structure as in Eclipse, Now create a folder, that should see you through.
So, I've seen many posts on this, but none has helped. I want to work with the assets folder, for organizational purposes. The images below show where the 'assets' folder is, along with the app.imi options of where it should be. I have tested this, and in the >exploded-aar/com../appcompat-v7/19.1.0/assets ... the files inside this seem to work. I can call on the .mp3 file and load and play it correctly (Though a few times it did not recognize it. Even when it was inside a folder, inside of the directory.)
In the src/main/assets folder, all the files are ignored. Is there a specific way I have to call this? In other words, must I also link the actual folder it is it? src/main/assets/music to load up the riseofcc.mp3?
I do not have 10 reputation to post images, so sorry for only links.
EDIT:Also I am using Android Studio 0.5.7
ANSWERED:
Thanks for Xavier Duchrohet for explaining exploded-aar is for the application's dependencies. I have learned that when calling upon a file inside your asset's folder using the code:
AssetManager assetManager = getAssets();
InputStream inputStream = null;
AssetFileDescriptor descriptor = assetManager.openFd("sound/explosion.ogg");
You must include the folder's parent inside the arguement.
Android Studio's app.iml has the asset's directory (src/main/assets) inside of its configuration's options.
Normally, to include sound files, I create a folder called raw, inside the app / src / main / res.
That is, I right click on the folder res and from the menu that appears, choose: New / Android Resource Diretory. Renaming in the window that appears, the Directory name field values for raw.
How it works for me, I hope this might have helped him.