2016-07-08 40 views
1

我是一個真正的初學者,但我想用代碼創建我的移動應用程序的外觀。我創建使用Photoshop處理圖像的背景,但我想代碼的按鈕,一切都在別人這裏是我有什麼(我添加的按鈕都沒有顯示出來):如何在代碼名稱1中的代碼主題?

public void start() { 
     if(current != null){ 
      current.show(); 
      return; 
     } 
     new StateMachine("/theme");   
    } 
    Button customer = new Button("Customer"); 
    Button gpsAntenna = new Button("Find An Antenna Near You"); 
    Button learnMore = new Button("Learn More About NEN Now"); 
    Button nenNow = new Button("NEN Now Webpage"); 
    public void stop() { 
     current = Display.getInstance().getCurrent(); 
     if(current instanceof Dialog) { 
      ((Dialog)current).dispose(); 
      current = Display.getInstance().getCurrent(); 
     } 
    } 

回答

1

你需要將它們添加到表格或容器。看看Form類和Container類,我認爲它們都有一個addComponent()方法。然後,您可能需要重新驗證表單以使其顯示。

如果將它們添加到容器中,則需要將它添加到表單中。

+0

同時查看史蒂夫的這段視頻,他一步一步瀏覽它:http://www.codenameone.com/blog/psd-to-app-converting-a-beautiful-design-into-a-native -mobile-app.html,您還可以在開發者指南中看到更多的文字逐步書寫相同的過程(稍微簡化):https://www.codenameone.com/manual/advanced-theming.html#_converting_a_psd_to_a_theme –

+0

太好了!我認爲隨着「getstarted app」主題出現的預先存在的代碼讓我感到困惑。我刪除了所有先前存在的代碼,現在我至少具有最基本的功能。謝謝。 –