iT邦幫忙

2021 iThome 鐵人賽

DAY 8
0
自我挑戰組

Android Studio 初學者的30天筆記系列 第 8

DAY8:基本元件及畫面設計實作

接下來要做一個簡單的剪刀石頭布的小小實作,會用到上述所介紹到的,那就開始囉!
首先,我們要將專案一開啟的”hello world”刪除,再來依序將各個元件加入,首先,先加入一個ExitText跟TextView。
這是拉進了兩個元件以後的畫面
https://ithelp.ithome.com.tw/upload/images/20210923/201404880zvSCH4LxJ.png
再來這兩張圖是我目前畫面的XML檔
https://ithelp.ithome.com.tw/upload/images/20210923/20140488yhGHsiaEdL.png
https://ithelp.ithome.com.tw/upload/images/20210923/20140488xUSYbjGTB4.png
接著,我將在TextView底下加入RadioGroup並在裡頭加入RadioButton。
其中有需要注意的地方則是,在我們RadioGroup裡頭的排序方法就是使用水平的方式,可以透過以下的xml檔得知。
https://ithelp.ithome.com.tw/upload/images/20210923/20140488VAZJuGYLkO.png
https://ithelp.ithome.com.tw/upload/images/20210923/20140488EbG07IUPZ4.png
https://ithelp.ithome.com.tw/upload/images/20210923/20140488FtEQu9wHC2.png
接著,我們要新增一個Button跟四個textview。
https://ithelp.ithome.com.tw/upload/images/20210923/201404887WhSIzJejN.png
以及以下是我的xml檔。
https://ithelp.ithome.com.tw/upload/images/20210923/20140488Vl6veqrNhY.png
https://ithelp.ithome.com.tw/upload/images/20210923/20140488zBRqMZXZQs.png
其實這幾個步驟都不難,只是每個元件之間會有關聯,我們必須使元件建立連接,使這些元件連接起來,當然我們也可以用打的方式去建立,兩者皆可!
這也簡單應用了我們前面所介紹的元件。
這個小遊戲的是我第一次使用Android Studio 做出的小小實作遊戲,也剛好在這個遊戲的畫面設計上能使用到前面所學!


上一篇
DAY7:版面配置及基本元件之簡介
下一篇
DAY9:元件與監聽事件簡介及實作
系列文
Android Studio 初學者的30天筆記30
圖片
  直播研討會
圖片
{{ item.channelVendor }} {{ item.webinarstarted }} |
{{ formatDate(item.duration) }}
直播中

尚未有邦友留言

立即登入留言