I encountered this problem when working on the project. I want to add an icon for each option menu of Android, and then change the arrangement of each menu item, the default menu items are arranged in a vertical column, similar to the content arrangement in the Android component ListView. However, I want to arrange each menu item in a square matrix, similar to the arrangement of the GridView, I searched for a long time on the network and found a helpful article, as shown below:
http://www.cnblogs.com/salam/archive/2011/04/04/2005329.html
I created a new project and followed it. I found that the default style still could not be changed, the menu item icon still could not be displayed, and the menu style could be changed by using a custom method, but it was a little troublesome. I downloaded the author's example and ran it. I found that he indeed changed the default menu style. Then I knew it, and I certainly ignored some places, I almost compared each file of my own project and the author's project, and then changed them to the same one. I found that the menu still could not be changed.
Finally, I noticed why I created a new project, where the background of the Activity is white and the background of the Activity is black. So I modified the AndroidManifest. xml file.
Run the following code:
<application android:name="MyApp" android:allowBackup="true" android:icon="@drawable/ic_launcher" android:label="@string/app_name" android:theme="@style/AppTheme" >
Change
<application android:name="MyApp" android:allowBackup="true" android:icon="@drawable/ic_launcher" android:label="@string/app_name">
When I run my project again, the background turns black and the icons of each menu item can be displayed, but they are still in a column.
I realized that what I previously ignored was exactly different from the AndroidManifest. xml file.
I found the difference between the two files again:
My
<uses-sdk android:minSdkVersion="8" android:targetSdkVersion="17"/>
Others
<uses-sdk android:minSdkVersion="3" />
Then I changed it
<uses-sdk android:minSdkVersion="8" />
Re-run my project. The result is that each menu item is in a square matrix.