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.
[amazon_link asins=’B01FM7GG58,B0784BZ5VY,B07BSCSBMP,B078BNQ313,B01M0JSAFU,B071HWTHPH|B07D99ND44,B073SC6CSL,B0725CGWQD,B077SFTKNK,B079SQF4BD,B078TXT3NB,B078X8RJ5Z,B079G93QND|B079VS947C,B0769H1RX1,B07CHL6XN6,B01MXFV5D3,B06XS15Y7Z,B0777T9SW7|B07CZPXGVJ,B076CJFW9C,B079876N49,B01N4N3GVO,B07CRGJW16,B06XW8Q72D’ template=’ProductCarousel’ store=’lifenews525-21|lifenews-21|lifenews0b-21|lifenews06-21′ marketplace=’IN|UK|IT|FR’ link_id=’ 6dc7df5c-d6b5-11e8-b8a9-85b380546e89′]