Author: wang

android, Android UI控件

option Menu 和 contextMenu

option Menu 1. create id item:=> privatestaticfinalintMTEM1=Menu.FIRST; privatestaticfinalintMTEM2=Menu.FIRST+1; privatestaticfinalintMTEM3=Menu.FIRST+2; 2. override onCreateOptionsMenu @Override public boolean onCreateOptionsMenu(Menu menu) { // TODO Auto-generated method stub menu.add(0,MTEM1,0,"RED"); menu.add(0,MTEM2,0,"GREEN"); menu.add(0,MTEM3,0,"BLACK"); //return super.onCreateOptionsMenu(menu); returntrue; }   3.overide onOptionsItemSelected public boolean onOptionsItemSelected(MenuItem item) { // TODO Auto-generated method...

android, Android UI控件

android 创建菜单

在ACTIVITY.JAVA 中 package com.example.menutest;   import android.app.Activity; import android.app.AlertDialog; import android.app.AlertDialog.Builder; import android.content.DialogInterface; import android.os.Bundle; import android.view.Menu; import android.view.MenuInflater; import android.view.MenuItem; import android.view.View; import android.view.View.OnClickListener; import android.widget.Button;   public class TestMenuActivity extends Activity{ private MenuInflater mi; private Button bt1; @Override...