Usage analysis of actionbar item in Android learning notes

This article describes the usage of Android actionbar item with examples. Share with you for your reference, as follows:

This section mainly describes how to use actionbar item. On the mobile phone, press the menu key to display the menu menu, but in the tablet, you can put the menu in the actionbar, and there are more items than on the mobile phone. Its usage is described in detail below:

1. Add in androidmanifest.xml

perhaps

If the version number is above 3.0, the system will automatically put the menu on the actionbar.

2. Prepare a menu. XML for loading. In fact, this is a traditional menu layout, with the addition of Android: showasaction = "ifroom|withtext". Ifroom means that as long as there is space on the actionbar, the item will be displayed, otherwise it will fall behind.

3. Code in activity:

In this way, an example of actionbar item is successfully completed.

More readers interested in Android related content can view the special topics of this site: introduction and advanced tutorial of Android development, summary of Android debugging skills and common problem solving methods, summary of Android basic component usage, summary of Android view skills, summary of Android layout skills and summary of Android control usage

I hope this article will help you in Android programming.

The content of this article comes from the network collection of netizens. It is used as a learning reference. The copyright belongs to the original author.
THE END
分享
二维码
< <上一篇
下一篇>>