Android menu default style settings

Source: Internet
Author: User
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"/&gt

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.
Related Article

Contact Us

The content source of this page is from Internet, which doesn't represent Alibaba Cloud's opinion; products and services mentioned on that page don't have any relationship with Alibaba Cloud. If the content of the page makes you feel confusing, please write us an email, we will handle the problem within 5 days after receiving your email.

If you find any instances of plagiarism from the community, please send an email to: info-contact@alibabacloud.com and provide relevant evidence. A staff member will contact you within 5 working days.

A Free Trial That Lets You Build Big!

Start building with 50+ products and up to 12 months usage for Elastic Compute Service

  • Sales Support

    1 on 1 presale consultation

  • After-Sales Support

    24/7 Technical Support 6 Free Tickets per Quarter Faster Response

  • Alibaba Cloud offers highly flexible support services tailored to meet your exact needs.