B.Cakir
B.Cakir

Reputation: 607

Drawable files name convention

Are there any best practices when it comes to naming drawable xml files?

Some of my files start with "button", other with "ic", even though their pretty much the same.

Upvotes: 6

Views: 4232

Answers (4)

Anonymous
Anonymous

Reputation: 1320

File names must contain only lowercase a-z, 0-9, or _

You can specify naming rules for your project for your better understanding e.g. drawable for CheckBox can be named "checkbox_bg.png"

Upvotes: 2

Swati Dongre
Swati Dongre

Reputation: 52

Try to name files so that related assets will group together inside a directory when they are sorted alphabetically. In particular, it helps to use a common prefix for each icon type. For example:

Icon: ic_done.png
Launcher Icons: ic_launcher_calendar.png
Menu Icons and Action bar icons: ic_menu_archieve.png
Tab icons: ic_tab_recent.png
Dialog icons: ic_dialog_date.png

Upvotes: 0

Amey
Amey

Reputation: 252

Yes there is a standard naming convention that google follows/recommends its ic_NAME_COLOR_SIZE.xml for example ic_arrow_drop_up_black_24dp.xml

And yes of course it has to be all lowercase with no spaces. Hope this helps!

Upvotes: 6

Deepak kaku
Deepak kaku

Reputation: 1278

ic stands for icons you can avoid using button as a prefix.

Upvotes: 0

Related Questions