我的個人觀點,不知道對不對(http://community.csdn.net/Expert/topic/4477/4477765.xml?temp=.6836969):
你所說的KEY_SOFTKEY1,KEY_SOFTKEY2,KEY_SOFTKEY3這幾個定義,應該是Nokia UI?。粒校芍械模疲酰欤欤茫幔睿觯幔蠖x的吧?
而MIDP2.0的Canvas規范并沒有定義這幾個。
請看:
《Series 60 Developer Platform 2.0: Specification v1.0》,
Page 77:
Left soft key, -6, "Left soft key" or left soft-key symbol
Right soft key, -7, "Right soft key" or right soft-key symbol
Middle soft key, -5, "Select", "Middle soft key" or similar symbol
所以我們的Nokia、Samsung和SonyEricsson專有程序中會這么定義:
/**
* Key code for the FIRE game action.
*/
public static final int KEY_FIRE = -5;
/**
* Key code for left soft key
*/
public static final int KEY_SOFT_LEFT = -6;
/**
* Key code for right soft key
*/
public static final int KEY_SOFT_RIGHT = -7;
在摩托羅拉專有的程序中則這么定義:
/**
* Key code for the FIRE game action.
*/
public static final int KEY_FIRE = 20;
/**
* Key code for left soft key
*/
public static final int KEY_SOFT_LEFT = 21;
/**
* Key code for right soft key
*/
public static final int KEY_SOFT_RIGHT = 22;
在西門子程序中則這么定義:
/**
* Key code for the FIRE game action.
*/
public static final int KEY_FIRE = -26;
/**
* Key code for left soft key
*/
public static final int KEY_SOFT_LEFT = -1;
/**
* Key code for right soft key
*/
public static final int KEY_SOFT_RIGHT = -4;
Softkeys并沒有被包含在MIDP2.0的規范中,所以,
如果你非要在手機上使用這幾個Softkeys,那么請注意手機的差異,你可能需要針對不同款手機分別定義了。
以下對撥打電話的手機按鍵的定義是在nokia、三星和Motorola(v80/220/300/400/500/600, e398, c650):
以下內容為程序代碼:
/**
* Key code for PHONE_ON key (green button)
*/
public static final int KEY_PHONE_ON = -10;
以下這種定義是在西門子:
以下內容為程序代碼:
/**
* Key code for PHONE_ON key (green button)
*/
public static final int KEY_PHONE_ON = -11;
以下這種定義是在Motorola platform phones iDEN, T280, T72x, v6x
以下內容為程序代碼:
/**
* Key code for PHONE_ON key (green button)
*/
public static final int KEY_PHONE_ON = -14;