Android studio creates menu file

Creating a file is so simple, I thought it was really easy, but it turned out to be not so simple in android studio

 

Let me tell you about my mistakes:

1. Create a diretory under res, just create a folder according to your own idea


 

After creation, you will find the created XML, even if it is written according to menu, the system will prompt
 

 

The system will prompt that there are no such labels.

 

So it must be that the previous method of creating folders and files is irregular.

 

2. Solutions

 

(1) Right-click the res folder first, as shown below, to create a resource directory



 

 

In the pop-up page, select the corresponding menu type

 



 

Then click OK, then the menu folder is created.

 

(2) Create the xml file of the menu, right-click in the menu folder, and select Create menu resource file, as shown below

 



 

Just enter the file name. Then the menu xml file as shown below can be edited.

 



 

 

Learning is important, don't use previous experience to write Android.

 

 

 

 

 

Guess you like

Origin http://10.200.1.11:23101/article/api/json?id=326687416&siteId=291194637