Basics about Menu in Android

Posted by Unknown Sabtu, 14 Juli 2012 0 komentar

Menus in Android 


Menu is the basic navigation method for an application which provides an interactive way to interact with user interface and defines the application actions for its users.


In Android version 2.3.X (API level 10) the Menu is the basic building block of the application invoked by the system when user press the menu button on device. In later versions from Android 3.0 on-wards this is replaced by an action bar on the top of device.


Android defines the three type of menus for applications

Option Menu

The option menu is the primary collection of action items for an application. If you are developing an application for android devices running the Android 2.3.X or lower version then option menu will be created by the system when ever user press the menu button on device. 


The Android 3.0 converts this into more effective method using the action bar.

Contextual Menu

A contextual menu is a floating menu invoked when user performs a long click on an element of the view.

Popup Menu

A popup menu displays a list of items in a vertical list that's anchored to the view that invoked the menu.

You can define the menus in your android application as XML resources which could be inflate in your activity or fragment.

See here a sample file defining a menu for an application

<?xml version="1.0" encoding="utf-8"?>
<menu xmlns:android="http://schemas.android.com/apk/res/android">
<item android:id="@+id/myaction1"
android:icon="@drawable/ic_myaction1"
android:title="@string/myaction1"
android:showAsAction="ifRoom"/>
<item android:id="@+id/help"
android:icon="@drawable/ic_help"
android:title="@string/help" />
</menu>



TERIMA KASIH ATAS KUNJUNGAN SAUDARA
Judul: Basics about Menu in Android
Ditulis oleh Unknown
Rating Blog 5 dari 5
Semoga artikel ini bermanfaat bagi saudara. Jika ingin mengutip, baik itu sebagian atau keseluruhan dari isi artikel ini harap menyertakan link dofollow ke https://apk-xda.blogspot.com/2012/07/basics-about-menu-in-android.html. Terima kasih sudah singgah membaca artikel ini.

0 komentar:

Posting Komentar

Trik SEO Terbaru support Online Shop Baju Wanita - Original design by Bamz | Copyright of apk xda.