XML构建Menu Android

例子:

class.java

/* (non-Javadoc) * @see android.app.Activity#onCreateOptionsMenu(android.view.Menu) */ @Override public boolean onCreateOptionsMenu(Menu menu) { // TODO Auto-generated method stub MenuInflater menuInflater = getMenuInflater(); menuInflater.inflate(R.menu.options_menu, menu); return super.onCreateOptionsMenu(menu); }

options_menu.xml

<?xml version="1.0" encoding="utf-8"?> <menu xmlns:android="http://schemas.android.com/apk/res/android"> <item android:id="@+id/OPTMENU_PLAYSTYLE" android:title="Playstyle"> <menu> <item android:id="@+id/OPTMENU_SINGLECYCLE" android:title="Singlecycle"></item> <item android:id="@+id/OPTMENU_ALLCYCLE" android:title="Allcycle"></item> <item android:id="@+id/OPTMENU_RANDOM" android:title="Random"></item> <item android:id="@+id/OPTMENU_SINGLEPLAY" android:title="Singleplay"></item> </menu> </item> <item android:id="@+id/OPTMENU_EXITPLAYER" android:title="ExitPlayer"></item> </menu>

 

 

你可能感兴趣的:(xml,android,Random,menu,encoding)