Android 菜單(OptionMenu)大全 建立你自己的菜單

菜單是用戶界面中最常見的元素之一,使用非常頻繁,在Android中,菜單被分為如下三種,選項菜單(OptionsMenu)、上下文菜單(ContextMenu)和子菜單(SubMenu),今天這講是OptionsMenu 

  一、概述

  public boolean onCreateOptionsMenu(Menu menu):使用此方法調用OptionsMenu 。

  public boolean onOptionsItemSelected(MenuItem item):選中菜單項后發生的動作。

  public void onOptionsMenuClosed(Menu menu):菜單關閉后發生的動作。

  public boolean onPrepareOptionsMenu(Menu menu):選項菜單顯示之前onPrepareOptionsMenu方法會被調用,你可以用此方法來根據打當時的情況調整菜單。

  public boolean onMenuOpened(int featureId, Menu menu):單打開后發生的動作。

  二、默認樣式

  默認樣式是在屏幕底部彈出一個菜單,這個菜單我們就叫他選項菜單OptionsMenu,一般情況下,選項菜單最多顯示2排每排3個菜單項,這些菜單項有文字有圖標,也被稱作Icon Menus,如果多于6項,從第六項開始會被隱藏,在第六項會出現一個More里,點擊More才出現第六項以及以后的菜單項,這些菜單項也被稱作Expanded Menus。下面介紹。

  

1.main.xml
<?xml version="1.0" encoding="utf-8"?>
<LinearLayout xmlns:android="http://schemas.android.com/apk/res/android"
android:orientation="vertical" android:layout_width="fill_parent"
android:layout_height="fill_parent" >

<TextView android:layout_width="wrap_content"
android:layout_height="wrap_content" android:text="請點擊 Menu鍵顯示選項菜單"
android:id="@+id/TextView02" />

</LinearLayout>

  2。重載onCreateOptionsMenu(Menu menu)方法

  重載onCreateOptionsMenu(Menu menu)方法,并在此方法中添加菜單項,最后返回true,如果false,菜單則不會顯示。

  

public boolean onCreateOptionsMenu(Menu menu)
@Override
public boolean onCreateOptionsMenu(Menu menu) {
/*
*
* add()方法的四個參數,依次是:
*
* 1、組別,如果不分組的話就寫Menu.NONE,
*
* 2、Id,這個很重要,Android根據這個Id來確定不同的菜單
*
* 3、順序,那個菜單現在在前面由這個參數的大小決定
*
* 4、文本,菜單的顯示文本
*/

menu.add(Menu.NONE, Menu.FIRST + 1, 5, "刪除").setIcon(

android.R.drawable.ic_menu_delete);

// setIcon()方法為菜單設置圖標,這里使用的是系統自帶的圖標,同學們留意一下,以

// android.R開頭的資源是系統提供的,我們自己提供的資源是以R開頭的

menu.add(Menu.NONE, Menu.FIRST + 2, 2, "保存").setIcon(

android.R.drawable.ic_menu_edit);

menu.add(Menu.NONE, Menu.FIRST + 3, 6, "幫助").setIcon(

android.R.drawable.ic_menu_help);

menu.add(Menu.NONE, Menu.FIRST + 4, 1, "添加").setIcon(

android.R.drawable.ic_menu_add);

menu.add(Menu.NONE, Menu.FIRST + 5, 4, "詳細").setIcon(

android.R.drawable.ic_menu_info_details);

menu.add(Menu.NONE, Menu.FIRST + 6, 3, "發送").setIcon(

android.R.drawable.ic_menu_send);

return true;

}

  3。為菜單項注冊事件

  使用onOptionsItemSelected(MenuItem item)方法為菜單項注冊事件

public boolean onOptionsItemSelected(MenuItem item)
@Override
public boolean onOptionsItemSelected(MenuItem item) {
switch (item.getItemId()) {

case Menu.FIRST + 1:

Toast.makeText(this, "刪除菜單被點擊了", Toast.LENGTH_LONG).show();

break;

case Menu.FIRST + 2:

Toast.makeText(this, "保存菜單被點擊了", Toast.LENGTH_LONG).show();

break;

case Menu.FIRST + 3:

Toast.makeText(this, "幫助菜單被點擊了", Toast.LENGTH_LONG).show();

break;

case Menu.FIRST + 4:

Toast.makeText(this, "添加菜單被點擊了", Toast.LENGTH_LONG).show();

break;

case Menu.FIRST + 5:

Toast.makeText(this, "詳細菜單被點擊了", Toast.LENGTH_LONG).show();

break;

case Menu.FIRST + 6:

Toast.makeText(this, "發送菜單被點擊了", Toast.LENGTH_LONG).show();

break;

}

return false;

}

  4。其他按需要重載

  完整代碼

DefaultMenu
package com.wjq.menu;

import android.app.Activity;
import android.os.Bundle;
import android.view.Menu;
import android.view.MenuItem;
import android.widget.Toast;

public class DefaultMenu extends Activity {
/** Called when the activity is first created. */
@Override
public void onCreate(Bundle savedInstanceState) {
super.onCreate(savedInstanceState);
setContentView(R.layout.main);
}

@Override
public boolean onCreateOptionsMenu(Menu menu) {
/*
*
* add()方法的四個參數,依次是:
*
* 1、組別,如果不分組的話就寫Menu.NONE,
*
* 2、Id,這個很重要,Android根據這個Id來確定不同的菜單
*
* 3、順序,那個菜單現在在前面由這個參數的大小決定
*
* 4、文本,菜單的顯示文本
*/

menu.add(Menu.NONE, Menu.FIRST + 1, 5, "刪除").setIcon(

android.R.drawable.ic_menu_delete);

// setIcon()方法為菜單設置圖標,這里使用的是系統自帶的圖標,同學們留意一下,以

// android.R開頭的資源是系統提供的,我們自己提供的資源是以R開頭的

menu.add(Menu.NONE, Menu.FIRST + 2, 2, "保存").setIcon(

android.R.drawable.ic_menu_edit);

menu.add(Menu.NONE, Menu.FIRST + 3, 6, "幫助").setIcon(

android.R.drawable.ic_menu_help);

menu.add(Menu.NONE, Menu.FIRST + 4, 1, "添加").setIcon(

android.R.drawable.ic_menu_add);

menu.add(Menu.NONE, Menu.FIRST + 5, 4, "詳細").setIcon(

android.R.drawable.ic_menu_info_details);

menu.add(Menu.NONE, Menu.FIRST + 6, 3, "發送").setIcon(

android.R.drawable.ic_menu_send);

return true;

}

@Override
public boolean onOptionsItemSelected(MenuItem item) {
switch (item.getItemId()) {

case Menu.FIRST + 1:

Toast.makeText(this, "刪除菜單被點擊了", Toast.LENGTH_LONG).show();

break;

case Menu.FIRST + 2:

Toast.makeText(this, "保存菜單被點擊了", Toast.LENGTH_LONG).show();

break;

case Menu.FIRST + 3:

Toast.makeText(this, "幫助菜單被點擊了", Toast.LENGTH_LONG).show();

break;

case Menu.FIRST + 4:

Toast.makeText(this, "添加菜單被點擊了", Toast.LENGTH_LONG).show();

break;

case Menu.FIRST + 5:

Toast.makeText(this, "詳細菜單被點擊了", Toast.LENGTH_LONG).show();

break;

case Menu.FIRST + 6:

Toast.makeText(this, "發送菜單被點擊了", Toast.LENGTH_LONG).show();

break;

}

return false;

}

@Override
public void onOptionsMenuClosed(Menu menu) {
Toast.makeText(this, "選項菜單關閉了", Toast.LENGTH_LONG).show();
}

@Override
public boolean onPrepareOptionsMenu(Menu menu) {
Toast.makeText(this,
"選項菜單顯示之前onPrepareOptionsMenu方法會被調用,你可以用此方法來根據打當時的情況調整菜單",
Toast.LENGTH_LONG).show();

// 如果返回false,此方法就把用戶點擊menu的動作給消費了,onCreateOptionsMenu方法將不會被調用

return true;

}
}

5.效果瀏覽

  

  三、自定義樣式

  

1.gridview_menu.xml
<?xml version="1.0" encoding="utf-8"?>
<LinearLayout xmlns:android="http://schemas.android.com/apk/res/android"
android:orientation="vertical"
android:layout_width="fill_parent"
android:layout_height="fill_parent"
>
<GridView
android:id="@+id/gridview"
android:layout_width="fill_parent"
android:layout_height="fill_parent"
android:numColumns="4"
android:verticalSpacing="10dip"
android:horizontalSpacing="10dip"
android:stretchMode="columnWidth"
android:gravity="center"
/>

</LinearLayout>

   首先自定義菜單界面,我是GridView來包含菜單項,4列3行

  

2.item_menu.xml
<?xml version="1.0" encoding="utf-8"?>
<RelativeLayout xmlns:android="http://schemas.android.com/apk/res/android"
android:id="@+id/RelativeLayout_Item"
android:layout_width="fill_parent" android:layout_height="wrap_content"
android:paddingBottom="5dip">
<ImageView android:id="@+id/item_image"
android:layout_centerHorizontal="true" android:layout_width="wrap_content"
android:layout_height="wrap_content"></ImageView>
<TextView android:layout_below="@id/item_image" android:id="@+id/item_text"
android:layout_centerHorizontal="true" android:layout_width="wrap_content"
android:layout_height="wrap_content" android:text="選項"></TextView>
</RelativeLayout>

菜單項的現實樣式,一個圖標和一個文字。

  3.定義

  

代碼
private boolean isMore = false;// menu菜單翻頁控制
AlertDialog menuDialog;// menu菜單Dialog
GridView menuGrid;
View menuView;

private final int ITEM_SEARCH = 0;// 搜索
private final int ITEM_FILE_MANAGER = 1;// 文件管理
private final int ITEM_DOWN_MANAGER = 2;// 下載管理
private final int ITEM_FULLSCREEN = 3;// 全屏
private final int ITEM_MORE = 11;// 菜單


/** 菜單圖片 **/
int[] menu_image_array = { R.drawable.menu_search,
R.drawable.menu_filemanager, R.drawable.menu_downmanager,
R.drawable.menu_fullscreen, R.drawable.menu_inputurl,
R.drawable.menu_bookmark, R.drawable.menu_bookmark_sync_import,
R.drawable.menu_sharepage, R.drawable.menu_quit,
R.drawable.menu_nightmode, R.drawable.menu_refresh,
R.drawable.menu_more };
/** 菜單文字 **/
String[] menu_name_array = { "搜索", "文件管理", "下載管理", "全屏", "網址", "書簽",
"加入書簽", "分享頁面", "退出", "夜間模式", "刷新", "更多" };
/** 菜單圖片2 **/
int[] menu_image_array2 = { R.drawable.menu_auto_landscape,
R.drawable.menu_penselectmodel, R.drawable.menu_page_attr,
R.drawable.menu_novel_mode, R.drawable.menu_page_updown,
R.drawable.menu_checkupdate, R.drawable.menu_checknet,
R.drawable.menu_refreshtimer, R.drawable.menu_syssettings,
R.drawable.menu_help, R.drawable.menu_about, R.drawable.menu_return };
/** 菜單文字2 **/
String[] menu_name_array2 = { "自動橫屏", "筆選模式", "閱讀模式", "瀏覽模式", "快捷翻頁",
"檢查更新", "檢查網絡", "定時刷新", "設置", "幫助", "關于", "返回" };
4.public boolean onMenuOpened(int featureId, Menu menu)
@Override
public boolean onMenuOpened(int featureId, Menu menu) {
if (menuDialog == null) {
menuDialog = new AlertDialog.Builder(this).setView(menuView).show();
} else {
menuDialog.show();
}
return false;// 返回為true 則顯示系統menu
}

如果第一次打開則設置視圖,否則直接顯示menuDialog視圖。

  

5.private SimpleAdapter getMenuAdapter(String[] menuNameArray,
private SimpleAdapter getMenuAdapter(String[] menuNameArray,
int[] imageResourceArray) {
ArrayList<HashMap<String, Object>> data = new ArrayList<HashMap<String, Object>>();
for (int i = 0; i < menuNameArray.length; i++) {
HashMap<String, Object> map = new HashMap<String, Object>();
map.put("itemImage", imageResourceArray[i]);
map.put("itemText", menuNameArray[i]);
data.add(map);
}
SimpleAdapter simperAdapter = new SimpleAdapter(this, data,
R.layout.item_menu, new String[] { "itemImage", "itemText" },
new int[] { R.id.item_image, R.id.item_text });
return simperAdapter;
}

為菜單添加菜單項。

6.public boolean onCreateOptionsMenu(Menu menu)
@Override
public boolean onCreateOptionsMenu(Menu menu) {
menu.add("menu");// 必須創建一項
return super.onCreateOptionsMenu(menu);
}
7.protected void onCreate(Bundle savedInstanceState)
@Override
protected void onCreate(Bundle savedInstanceState) {
// TODO Auto-generated method stub
super.onCreate(savedInstanceState);

setContentView(R.layout.main);

menuView = View.inflate(this, R.layout.gridview_menu, null);
// 創建AlertDialog
menuDialog = new AlertDialog.Builder(this).create();
menuDialog.setView(menuView);
menuDialog.setOnKeyListener(new OnKeyListener() {
public boolean onKey(DialogInterface dialog, int keyCode,
KeyEvent event) {
if (keyCode == KeyEvent.KEYCODE_MENU)// 監聽按鍵
dialog.dismiss();
return false;
}
});

menuGrid = (GridView) menuView.findViewById(R.id.gridview);
menuGrid.setAdapter(getMenuAdapter(menu_name_array, menu_image_array));
/** 監聽menu選項 **/
menuGrid.setOnItemClickListener(new OnItemClickListener() {
public void onItemClick(AdapterView<?> arg0, View arg1, int arg2,
long arg3) {
switch (arg2) {
case ITEM_SEARCH:// 搜索

break;
case ITEM_FILE_MANAGER:// 文件管理

break;
case ITEM_DOWN_MANAGER:// 下載管理

break;
case ITEM_FULLSCREEN:// 全屏

break;
case ITEM_MORE:// 翻頁
if (isMore) {
menuGrid.setAdapter(getMenuAdapter(menu_name_array2,
menu_image_array2));
isMore = false;
} else {// 首頁
menuGrid.setAdapter(getMenuAdapter(menu_name_array,
menu_image_array));
isMore = true;
}
menuGrid.invalidate();// 更新menu
menuGrid.setSelection(ITEM_MORE);
break;
}


}
});
}
完整代碼
package com.wjq.menu;


import java.util.ArrayList;
import java.util.HashMap;

import android.app.Activity;
import android.app.AlertDialog;
import android.content.DialogInterface;
import android.content.DialogInterface.OnKeyListener;
import android.os.Bundle;
import android.view.KeyEvent;
import android.view.Menu;
import android.view.View;
import android.widget.AdapterView;
import android.widget.GridView;
import android.widget.SimpleAdapter;
import android.widget.AdapterView.OnItemClickListener;

public class CustomizeMenu extends Activity {

private boolean isMore = false;// menu菜單翻頁控制
AlertDialog menuDialog;// menu菜單Dialog
GridView menuGrid;
View menuView;

private final int ITEM_SEARCH = 0;// 搜索
private final int ITEM_FILE_MANAGER = 1;// 文件管理
private final int ITEM_DOWN_MANAGER = 2;// 下載管理
private final int ITEM_FULLSCREEN = 3;// 全屏
private final int ITEM_MORE = 11;// 菜單


/** 菜單圖片 **/
int[] menu_image_array = { R.drawable.menu_search,
R.drawable.menu_filemanager, R.drawable.menu_downmanager,
R.drawable.menu_fullscreen, R.drawable.menu_inputurl,
R.drawable.menu_bookmark, R.drawable.menu_bookmark_sync_import,
R.drawable.menu_sharepage, R.drawable.menu_quit,
R.drawable.menu_nightmode, R.drawable.menu_refresh,
R.drawable.menu_more };
/** 菜單文字 **/
String[] menu_name_array = { "搜索", "文件管理", "下載管理", "全屏", "網址", "書簽",
"加入書簽", "分享頁面", "退出", "夜間模式", "刷新", "更多" };
/** 菜單圖片2 **/
int[] menu_image_array2 = { R.drawable.menu_auto_landscape,
R.drawable.menu_penselectmodel, R.drawable.menu_page_attr,
R.drawable.menu_novel_mode, R.drawable.menu_page_updown,
R.drawable.menu_checkupdate, R.drawable.menu_checknet,
R.drawable.menu_refreshtimer, R.drawable.menu_syssettings,
R.drawable.menu_help, R.drawable.menu_about, R.drawable.menu_return };
/** 菜單文字2 **/
String[] menu_name_array2 = { "自動橫屏", "筆選模式", "閱讀模式", "瀏覽模式", "快捷翻頁",
"檢查更新", "檢查網絡", "定時刷新", "設置", "幫助", "關于", "返回" };
@Override
protected void onCreate(Bundle savedInstanceState) {
// TODO Auto-generated method stub
super.onCreate(savedInstanceState);

setContentView(R.layout.main);

menuView = View.inflate(this, R.layout.gridview_menu, null);
// 創建AlertDialog
menuDialog = new AlertDialog.Builder(this).create();
menuDialog.setView(menuView);
menuDialog.setOnKeyListener(new OnKeyListener() {
public boolean onKey(DialogInterface dialog, int keyCode,
KeyEvent event) {
if (keyCode == KeyEvent.KEYCODE_MENU)// 監聽按鍵
dialog.dismiss();

轉載于:https://www.cnblogs.com/Free-Thinker/p/4153632.html

本文來自互聯網用戶投稿,該文觀點僅代表作者本人,不代表本站立場。本站僅提供信息存儲空間服務,不擁有所有權,不承擔相關法律責任。
如若轉載,請注明出處:http://www.pswp.cn/news/376417.shtml
繁體地址,請注明出處:http://hk.pswp.cn/news/376417.shtml
英文地址,請注明出處:http://en.pswp.cn/news/376417.shtml

如若內容造成侵權/違法違規/事實不符,請聯系多彩編程網進行投訴反饋email:809451989@qq.com,一經查實,立即刪除!

相關文章

160 - 27 Cosh.1

環境 Windows XP sp3 工具 exeinfope ollydbg 查殼 無殼的MFC程序 測試 彈出這個&#xff1a; 是一個CD-CHECK保護的程序。 字符串搜索&#xff0c;一下子就能來到這里&#xff1a; 0040121A . 68 9C304000 push Cosh_1.0040309C …

什么時候加上android.intent.category.DEFAULT

1、要弄清楚這個問題&#xff0c;首先需要弄明白什么是implicit(隱藏) intent什么是explicit(明確) intent。 Explicit Intent明確的指定了要啟動的Acitivity &#xff0c;比如以下Java代碼&#xff1a; Intent intent new Intent(this, B.class) Implicit Intent沒有明確的指…

[BZOJ 2165] 大樓 【DP + 倍增 + 二進制】

題目鏈接&#xff1a;BZOJ - 2165 題目分析&#xff1a; 這道題我讀了題之后就想不出來怎么做&#xff0c;題解也找不到&#xff0c;于是就請教了黃學長&#xff0c;黃學長立刻秒掉了這道題&#xff0c;然后我再看他的題解才寫出來。。Orz 使用 DP 倍增 &#xff0c;用狀態 f[…

oracle創建表空間

注意點&#xff1a; 1.如果在PL/SQL 等工具里打開的話&#xff0c;直接修改下面的代碼中[斜體加粗部分]執行 2.確保路徑存在&#xff0c;比如【D:\oracle\oradata\Oracle9i\】也就是你要保存文件的路徑存在 /*分為四步 */ /*第1步&#xff1a;創建臨時表空間 */ create tempor…

160 - 28 CoSH.2

環境 Windows xp sp3 工具 exeinfope ollydbg 查殼 無殼的MFC程序 測試 輸入 Nmae:123456 Serial:12345 點擊“CHECK”后彈出錯誤提示的消息框&#xff0c;然后程序自己結束掉 依然是字符串搜索&#xff1a; 004014DB . 8B1D FC214000 mov ebx,dword ptr ds…

負載均衡情況下獲取真實ip的方法

公司用了硬件負載均衡&#xff0c;最近發現日志中的用戶ip都為負載均衡器的ip&#xff0c;業務需要所以要改為用戶真實ip&#xff0c;下面記錄一下&#xff01; 1、打開文件&#xff1a;/etc/httpd/conf/httd.conf。2、在文件中查找&#xff1a;”CustomLog”,找到如下配置塊: …

ASP.NET MVC5 + EF6 入門教程 (5) Model和Entity Framework

文章來源&#xff1a; Slark.NET-博客園 http://www.cnblogs.com/slark/p/mvc-5-ef-6-get-started-model.html 上一節&#xff1a;ASP.NET MVC 5 入門教程 (4) View和ViewBag 下一節&#xff1a;ASP.NET MVC5 EF6 入門教程 (6) View中的Razor使用 源碼下載&#xff1a;點我下…

160 - 29 cosh.3

環境 Windows xp sp3 工具 exeinfope ollydbg 查殼 無殼的MFC程序 測試 字符串搜索&#xff1a; 004014F5 |. E8 AA030000 call <jmp.&MFC42.#CWnd::GetWindowTextLengthA_> 004014FA |. 8945 EC mov [local.5],eax 004014FD |. 837D EC 0…

hdu--4902--線段樹

題意 前面一段廢話 這題 最有意思的應該是出題人 是clj 這題的時限放的太寬了 給了15s 我也是醉了 區間更新。 1 #include <iostream>2 #include <algorithm>3 using namespace std;4 5 const int size 200010;6 int a[size];7 struct data8 {9 int L , R ,…

(五) 面向對象類設計原則

1. 開閉原則&#xff08;the Open Closed Principle OCP&#xff09; 一個模塊在擴展性方面應該是開放的而在更改性方面應該是封閉的。因此在進行面向對象設計時要盡量考慮接口封裝機制、抽象機制和多態技術。該原則同樣適合于非面向對象設計的方法&#xff0c;是軟件工程 設計…

160 - 30 cracking4all.1

環境 Windows XP sp3 工具 exeinfope ollydbg 查殼 無殼的VB程序 測試 這個serial藏得比較里面&#xff0c;多點幾下才能看到 字符串搜索&#xff1a; 00403338 . 50 push eax ; /var18 00403339 . 51 …

java2s.com

http://www.java2s.com/Code/JavaAPI/CatalogJavaAPI.htm轉載于:https://www.cnblogs.com/reborn2012/p/3326445.html

MVC5 + EF6 入門完整教程

MVC5 EF6 入門完整教程 原文:MVC5 EF6 入門完整教程第0課 從0開始 ASP.NET MVC開發模式和傳統的WebForm開發模式相比&#xff0c;增加了很多"約定"。 直接講這些 "約定" 會讓人困惑&#xff0c;而且東西太多容易忘記。 和微軟官方教程不同&#xff0c…

160 - 31 cracking4all.2

環境 Windows xp sp3 工具 exeinfope ollydbg 查殼 無殼VB程序 測試 輸入1234567 OD載入字符串搜素&#xff0c;往上翻就看到這里&#xff0c;我截取部分片段&#xff1a; 00402C26 . 8D55 98 lea edx,dword ptr ss:[ebp-0x68] ; 取serial長度…

stm32的DFU使用方法

stm32的dfu看上去是個很高級的東西&#xff0c;似乎可以通過USB給內部flash、外部spi flash、外部nor等東西刷寫數據、把數據讀出來&#xff0c;但是用了一下感覺確實有點麻煩。 先不管原理是怎樣的&#xff0c;使用方法是這樣&#xff1a; 1、先下載這個Dfuse&#xff0c;然后…

160 - 32 genocide1

環境 Windows xp sp3 工具 upx exeinfope ollydbg 查殼 發現是upx殼&#xff0c;手脫的話會不干凈&#xff0c;影響OD分析。 所以就直接用 upx -d 脫了 手脫&#xff1a; upx -d: 用upx -d 脫的版本進行分析。 第一次運行時顯示這個&#xff1a; 缺少Reg.dat…

vector function trmplate

/*vectorfunction templateprogrammer:qpz */ #include <iostream> #include <vector> #define MAX 10 using namespace std; class Myclass{ private:vector <int> vel;//可均分的動態數組 public:void Add(int x){vel.push_back(x);}void print(); }; void…

軟件工程個人項目11061180王宇杰

&#xff08;1&#xff09;我完全不知道要花費多少時間&#xff0c;因為從來沒有進行過類似的項目&#xff0c;涉及的很多問題我以前也根本不會。簡單的估計一下&#xff0c;這至少是15小時的工作量。 &#xff08;2&#xff09;前期的準備工作很耗時間&#xff0c;因為一開始根…

160 - 33 Cruehead.1

環境 windows xp sp3 工具 exeinfo pe ollydbg 查殼 無殼的匯編程序&#xff08;OD載入的出來的&#xff09; 測試 當name輸入為數字時&#xff0c;會彈出兩次錯誤框。 OD載入搜字符串&#xff0c;發現有兩個地方&#xff1a; 0040134D /$ 6A 30 push 0x…

mac osx 10.10 pip 安裝問題

在mac osx 升級到 10.10(Yosemite)以后&#xff0c;用pip以及easy_install 安裝python包的時候&#xff0c;如果包需要編譯&#xff0c;就會編譯失敗&#xff0c;錯誤如下&#xff1a; build/temp.macosx-10.10-x86_64-2.7/greenlet.o -o build/lib.macosx-10.10-x86_64-2.7/gr…