自拍偷在线精品自拍偷,亚洲欧美中文日韩v在线观看不卡

BlackBerry開(kāi)發(fā)實(shí)現(xiàn)類似Lwuit的Tabbed Pane效果

移動(dòng)開(kāi)發(fā)
本文向大家介紹一下Black Berry開(kāi)發(fā)實(shí)現(xiàn)類似Lwuit的Tabbed Pane效果,Lwuit雖然有Black Berry的版本,但是對(duì)其源代碼進(jìn)行分析過(guò)后才發(fā)現(xiàn)并不能直接應(yīng)用于實(shí)際項(xiàng)目中。

本文和大家重點(diǎn)學(xué)習(xí)一下Black Berry開(kāi)發(fā)實(shí)現(xiàn)類似Lwuit的Tabbed Pane效果,Lwuit雖然有Black Berry的版本,它將所有版本的包括QWERTY、suretype、touch等的不同系統(tǒng)版本混合到一起,給裁剪帶來(lái)很大難度。

BlackBerry開(kāi)發(fā)實(shí)現(xiàn)類似Lwuit的TabbedPane效果

Lwuit雖然有BlackBerry開(kāi)發(fā)的版本,但是對(duì)其源代碼進(jìn)行分析過(guò)后才發(fā)現(xiàn)并不能直接應(yīng)用于實(shí)際項(xiàng)目中,它將所有版本的包括QWERTY、suretype、touch等的不同系統(tǒng)版本混合到一起,給裁剪帶來(lái)很大難度。目前對(duì)其設(shè)計(jì)結(jié)構(gòu)并不十分明確,所以源代碼的裁剪過(guò)程比較混亂。雖然blackberryUI不提供類似Lwuit的分頁(yè)效果,但是我們可以利用現(xiàn)有的API簡(jiǎn)單的模仿。等一些目前棘手的問(wèn)題解決后,再慢慢研究吧。。。

兩種實(shí)現(xiàn)方法:

1、使用屏幕Screen切換;

2、使用Graphics封裝。

這兩種方法都要用到滾輪的navigationMovement()事件響應(yīng)函數(shù),所以必須在需要切換的屏幕中重寫(xiě)這個(gè)事件。

◆實(shí)現(xiàn)一:使用屏幕Screen切換

思路:在UiApplication的構(gòu)造函數(shù)中先將這兩個(gè)屏幕壓入堆棧。然后創(chuàng)建兩個(gè)Sreen,在每個(gè)Screen中重寫(xiě)navigationMovement()方法。在navigationMovement()中獲取UiApplication的對(duì)象,然后調(diào)用UiApplication.pushScreen()將另外一個(gè)界面壓入堆棧。在另外一個(gè)界面中,調(diào)用UiApplication.popScreen()將自身彈出堆棧。

***個(gè)屏幕中的代碼: 

  1. viewplaincopytoclipboardprint?  
  2. /*  
  3. *滾輪滾動(dòng)事件響應(yīng)  
  4. *滾輪動(dòng)作:向上dy=-1,向下dy=1,向左dx=-1,向右dx=1 
  5. *@seenet.rim.device.api.ui.Screen#navigationMovement(int,int,int,int)  
  6. */  
  7. protectedbooleannavigationMovement(intdx,intdy,intstatus,inttime){  
  8. //Dialog.alert("TrackBallmoved:\r\n"+"x:"+dx+"\r\ny:"+dy);  
  9. if(dx>0&&this.isDisplayed()){  
  10. SillyDowntheApp=(SillyDown)this.getApplication();  
  11. theApp.popScreen(theApp.getFirstScreen());  
  12. returntrue;  
  13. }  
  14. returnfalse;  
  15. }  
  16. /*  
  17. *滾輪滾動(dòng)事件響應(yīng)  
  18. *滾輪動(dòng)作:向上dy=-1,向下dy=1,向左dx=-1,向右dx=1 
  19. *@seenet.rim.device.api.ui.Screen#navigationMovement(int,int,int,int)  
  20. */  
  21. protectedbooleannavigationMovement(intdx,intdy,intstatus,inttime){  
  22. // Dialog.alert("TrackBallmoved:\r\n"+"x:"+dx+"\r\ny:"+dy);  
  23.  if(dx>0&&this.isDisplayed()){  
  24.   SillyDowntheApp=(SillyDown)this.getApplication();  
  25.   theApp.popScreen(theApp.getFirstScreen());  
  26.   returntrue;  
  27.   }  
  28.  returnfalse;  
  29.  }  
  30.  
  31. 第二個(gè)屏幕中的代碼:  
  32.  
  33. viewplaincopytoclipboardprint?  
  34. /*  
  35. *滾輪滾動(dòng)事件響應(yīng)  
  36. *滾輪動(dòng)作:向上dy=-1,向下dy=1,向左dx=-1,向右dx=1 
  37. *@seenet.rim.device.api.ui.Screen#navigationMovement(int,int,int,int)  
  38. */  
  39. protectedbooleannavigationMovement(intdx,intdy,intstatus,inttime){  
  40. //TODOAuto-generatedmethodstub  
  41. if(dx<0&&this.isDisplayed()){  
  42. SillyDowntheApp=(SillyDown)this.getApplication();  
  43. theApp.pushScreen(theApp.getFirstScreen());  
  44. returntrue;  
  45. }  
  46. returnfalse;  
  47. }  
  48. /*  
  49. *滾輪滾動(dòng)事件響應(yīng)  
  50. *滾輪動(dòng)作:向上dy=-1,向下dy=1,向左dx=-1,向右dx=1 
  51. *@seenet.rim.device.api.ui.Screen#navigationMovement(int,int,int,int)  
  52. */  
  53. protectedbooleannavigationMovement(intdx,intdy,intstatus,inttime){  
  54.  //TODOAuto-generatedmethodstub  
  55.  if(dx<0&&this.isDisplayed()){  
  56.   SillyDowntheApp=(SillyDown)this.getApplication();  
  57.   theApp.pushScreen(theApp.getFirstScreen());  
  58.   returntrue;  
  59.  }  
  60.  returnfalse;  
  61. }  

 點(diǎn)評(píng):這種實(shí)現(xiàn)方式比較簡(jiǎn)單,但是效果一般。

◆實(shí)現(xiàn)二:使用Graphics封裝

思路:使用Graphics封裝一個(gè)LabelField,然后在navigationMovement()方法中重繪每個(gè)Field。

代碼:(正在編寫(xiě)中,先做個(gè)標(biāo)記)

點(diǎn)評(píng):可以使用這種方法封裝一個(gè)TabbedPane,界面顏色、寬度、高度、字體等都可以自行設(shè)置,界面比較華麗,但是代碼比較復(fù)雜。

【編輯推薦】

  1. BlackBerry開(kāi)發(fā)中Windows+eclipse環(huán)境配置及Helloworld
  2. 九步實(shí)現(xiàn)BlackBerry開(kāi)發(fā)程序發(fā)布應(yīng)用到app world
  3. BlackBerry開(kāi)發(fā)中七步實(shí)現(xiàn)創(chuàng)建app world賬號(hào)
  4. BlackBerry開(kāi)發(fā)環(huán)境中javaloader使用詳解
  5. 黑莓開(kāi)發(fā)中黑莓手機(jī)程序訪問(wèn)網(wǎng)絡(luò)能走代理服務(wù)器的三種方式

 

責(zé)任編輯:佚名 來(lái)源: csdn.net
相關(guān)推薦

2010-06-12 16:29:00

BlackBerry開(kāi)

2010-05-22 16:57:09

BlackBerry開(kāi)

2010-06-22 16:19:01

Black Berry

2011-05-03 15:13:23

BlackBerryWidget

2011-05-03 15:28:15

BlackBerryWidget

2011-05-03 16:41:04

BlackBerry

2010-08-20 13:47:11

BlackBerry應(yīng)BlackBerry

2010-06-12 16:41:10

BlackBerry開(kāi)

2011-01-27 17:33:10

DalvikAndroidQNX

2010-07-02 15:48:48

BlackBerry開(kāi)

2022-01-02 07:11:19

Windows 11操作系統(tǒng)微軟

2010-07-02 15:58:35

BlackBerry開(kāi)

2010-07-22 15:33:36

BlackBerry開(kāi)

2010-04-02 17:45:22

Black Berry

2011-03-31 13:15:18

BlackBerry

2010-07-22 15:22:58

BlackBerry開(kāi)

2011-04-18 11:00:34

使用音頻BlackBerry

2012-10-08 10:27:56

jQueryJSJavaScript

2011-07-22 18:20:04

IOS View 動(dòng)畫(huà)

2011-04-25 14:45:38

點(diǎn)贊
收藏

51CTO技術(shù)棧公眾號(hào)