game xml xml version1 0 encodingutf8 Relative Layout

  • Slides: 13
Download presentation

範例程式 步驟六:開啟遊戲程式的介面佈局檔game. xml並修改按鈕如下: <? xml version="1. 0" encoding="utf-8"? > <Relative. Layout … > …(和原來專案的程式碼相同)

範例程式 步驟六:開啟遊戲程式的介面佈局檔game. xml並修改按鈕如下: <? xml version="1. 0" encoding="utf-8"? > <Relative. Layout … > …(和原來專案的程式碼相同) <Text. View android: id="@+id/txt. Result" android: layout_width="wrap_content" android: layout_height="wrap_content" android: text="@string/result" android: layout_below="@id/btn. Net" android: layout_align. Left="@id/txt. Com" android: text. Size="20 sp" android: text. Color="#0 FFFFF" android: layout_margin. Top="20 dp" /> <Button android: id="@+id/btn. Show. Result" android: layout_width="wrap_content" android: layout_height="wrap_content" android: text="@string/btn. Show. Result" android: layout_below="@id/txt. Result" android: layout_center. Horizontal="true" android: text. Size="20 sp" android: layout_margin. Top="10 dp" /> </Relative. Layout> 11

範例程式 步驟七:開啟「局數統計畫面」的介面佈局檔game_result. xml,在最後 新增一個「回到遊戲」的按鈕。當程式只顯示單一Frame. Layout時 使用者可以按下這個按鈕回到遊戲畫面。 <? xml version="1. 0" encoding="utf-8"? > <Linear. Layout

範例程式 步驟七:開啟「局數統計畫面」的介面佈局檔game_result. xml,在最後 新增一個「回到遊戲」的按鈕。當程式只顯示單一Frame. Layout時 使用者可以按下這個按鈕回到遊戲畫面。 <? xml version="1. 0" encoding="utf-8"? > <Linear. Layout xmlns: android="http: //schemas. android. com/apk/res/android" android: orientation="vertical" android: layout_width="match_parent" android: layout_height="match_parent" > …(和原來專案的程式碼相同) <Button android: id="@+id/btn. Back. To. Game" android: layout_width="wrap_content" android: layout_height="wrap_content" android: layout_gravity="center_horizontal" android: text="@string/btn. Back. To. Game" android: text. Size="20 sp" /> </Linear. Layout> 12