Allan Macmillan
Allan Macmillan

Reputation: 1491

More than one .xml file in res/menu folder

When I have more than one xml file in my res/menu folder it only recognises one of them. I would like to have one Action bar for a certain activity and a different one for another. I take it this isn't some kind of illegal action?

Upvotes: 0

Views: 81

Answers (2)

pozuelog
pozuelog

Reputation: 1314

No, this is not illegal. Usually you have several menu xml files and you use what you want in your Activities.

for you... ¿Whats the meaning of 'recognise'?

Upvotes: 0

Ben Weiss
Ben Weiss

Reputation: 17922

You can declare several files under res/menu. They only need to have different names.

For example

res/menu/
  --menu_one.xml
  --menu_two.xml
  --menu_three.xml

is completely valid.

You'll need to reference them during menu creation via R.menu.menu_one, R.menu.menu_two or R.menu.menu_three.

Upvotes: 1

Related Questions