What are Assets?
Assets provide a way to include arbitrary files like text, xml, fonts, music, and video in your application.
According to Android User Guide :
Image Asset Studio helps you create various types of icons at different densities and shows you exactly where they’ll be placed in your project. It includes tools for adjusting your icons and adding backdrops, all while displaying the result in a preview pane, so they appear exactly as you intended.
Image Asset Studio helps you generate the following icon types:
- Launcher icons
- Action bar and tab icons
- Notification icons
Vector Asset Studio adds a vector graphic to the project as an XML file that describes the image. Maintaining one XML file can be easier than updating multiple raster graphics at various resolutions.
How to Create Assets in Android?
In this Section, You going to learn about how to create Image Assets and vector assets in android and how they can help you build an android application.
Here is a video Which will guide you step by step on how to create assets.
- Create a New Android Project.
- Now go to res folder then right click on drawable folder and click New you will see two options in the menu – 1. Image Assets 2. Vector Assets. Click on Any One of them.
- A window Will open Select Material Icon and click on android icon, Another Window Will open You can see there are different types of icons you can select like navigation, location, Editor, File etc. Choose any one of them.
- In the Previous window do not forget to enter the name of the file. Keep the file name simple. Try not to use special characters/symbols while naming your file, also follow the naming convention(Name the file for the purpose you are going to use like logo/user/password).
- Then Click Next a window will open showing you the destination folder of the file you are creating, check the name of your file and click finish.
- If the file was Image Asset it will be saved in Mipmap folder. If the file was vector asset then it will be stored in the drawable folder and an XML drawable file will be created. You can now change the color of your vector asset in the file. and use it wherever you want by giving the reference of the mipmap/ drawable folder. Example: @drawable/ or @mipmap/.
- You can only select default icons/ structures provided in the android studio in image/vector assets. If you want to learn how to add fonts in android in asset folder then visit here. Just add a .ttf file of your font and start using it.
- You can use assets as an icon in edit text. How?
- You can always change the color of your asset according to your theme.
- Always to try to design a material application.
- Android 4.4 (API level 20) and lower doesn’t support vector drawables.
- Limit a vector image to a maximum of 200 x 200 dp; otherwise, it can take too long to draw.
How useful was this post?
Do not forget to rate! this helps us to Improve.
Average rating / 5. Vote count:
We are sorry that this post was not useful for you!
Let us improve this post!
Thanks for your feedback!