Home
顯示具有 Android Studio 標籤的文章。 顯示所有文章
顯示具有 Android Studio 標籤的文章。 顯示所有文章
2018年4月29日 星期日

[程式] Android Studio : Tools屬性說明(Tools Attributes)

Tools用於開發階段,設計與編譯時期使用,當產生APK時,就會自動移除相關屬性,不會影響APK的大小或執行期的行為。
要使用tools相關屬性,需要在根目錄新增tools的namespace(命名空間)
xmlns:tools="http://schemas.android.com/tools"
細部項目請參考官方文件

相關資訊圖片:

Tools Attributes View1 (Without Tools Attributes)畫面
Tools Attributes View1 (Without Tools Attributes)畫面
2018年4月19日 星期四

[程式] Android Studio : ListView With Header And Footer

Android Studio : ListView With Header And Footer

(有頁首與頁尾的ListView)

有頁首與頁尾的ListView,看起來比較完整,只要使用addHeaderView與addFooterView,就可以達到這個效果,來實作吧!


相關資訊圖片:

ListView With Header And Footer View1 (activity_main.xml)畫面
ListView With Header And Footer View1 (activity_main.xml)畫面

[程式] Android Studio : ListView Using BaseAdapter

Android Studio : ListView Using BaseAdapter(使用BaseAdapter的ListView範例)

ListView是'很常用的功能,E-Mail信件、選單等都是利用此功能,使用最基本的BaseAdapter做一個簡單的範例。


相關資訊圖片:

ListView Using BaseAdapter View1 (activity_main.xml)畫面
ListView Using BaseAdapter View1 (activity_main.xml)畫面
2018年4月14日 星期六

[程式] Android Studio : Read File From Raw Folder

Android Studio : Read File From Raw Folder (從raw目錄讀取檔案資料)

從Raw目錄讀取檔案資料後,呈現在畫面上。


相關資訊圖片:

Read File From Raw Folder View (activity_main.xml)畫面
Read File From Raw Folder View (activity_main.xml)畫面
2018年4月11日 星期三

[程式] Android Studio : Lights Game

Android Studio : Lights Game

會實作這個遊戲,最主要的原因是看不懂再玩甚麼,實作之後就會發現遊戲規則。
  • 亂數產生按鈕的背景顏色
  • 顏色順序
  • 點擊 按鈕1 → 按鈕1 與 按鈕2 變色,按鈕4 → 按鈕3 與 按鈕4 變色
  • 點擊 按鈕2 → 按鈕1、按鈕2 與 按鈕3 變色,按鈕3 → 按鈕2、按鈕3 與 按鈕4 變色
  • 四個按鈕都變成綠色,結束遊戲


範例網址:

https://www.youtube.com/watch?v=WrjI8RH25ss

相關資訊圖片:

Lights Game View (activity_main.xml)畫面
Lights Game View (activity_main.xml)畫面
2018年3月22日 星期四

[程式] Android Studio : Simple High Score Screen

Android Studio : Simple High Score Screen

上一篇 [程式] Android Studio : Simple Quiz Game 有說到,要增加一個排行榜(leaderboard)的功能,剛好也有範例,就直接來實作吧!


範例網址:

https://www.youtube.com/watch?v=_cV7cgQFDo0

相關資訊圖片:

Simple High Screen Screen View1畫面
Simple High Screen Screen View1 (activity_main.xml)畫面
2018年3月21日 星期三

[程式] Android Studio : Simple Quiz Game

Android Studio : Simple Quiz Game

這個益智問答遊戲主要是四選一選擇題,透過亂數產生問題,若一直達對問題,便能累積分數,若答錯後,還有提示視窗,詢問要離開或是繼續,遊戲的完成度比較好,可以與 [程式] Android Studio : Simple True False Quiz Game 的遊戲整合,讓題目不重複出現,只是這樣最高分就比較沒有趣味了,換個方向想,或許這樣問題會重複出現的遊戲適合用在語文學習類,例如背單字等...需要加深印象的的資訊。


範例網址:

https://www.youtube.com/watch?v=JA9s_Fntg_4

相關資訊圖片:

Simple Quiz Game View畫面
Simple Quiz Game View畫面
2018年3月20日 星期二

[程式] Android Studio : Simple True False Quiz Game

Android Studio : Simple True False Quiz Game

簡單的益智問答遊戲,只有True False值,算是入門的遊戲,另外有多選一模式,下次再來實作吧!


範例網址:

https://www.youtube.com/watch?v=-kdzyGXziSA

相關資訊圖片:

Simple True False View畫面
Simple True False View畫面
2018年3月19日 星期一

[程式] Android Studio : Simple Roulette Game II

Android Studio : Simple Roulette Game II (輪盤遊戲第二版)

寫完 [程式] Android Studio : Simple Roulette Game 後,忽然想到有另外一種輪盤遊戲的呈現方式,因此稍微修改一下後,做了指針式的羅盤遊戲,重點在於羅盤與指針的圖片大小一樣,這樣程式在撰寫比較簡單,否則計算旋轉的中心點,有時候還蠻麻煩的。


相關資訊圖片:

Roulette view畫面
Roulette view畫面
2018年3月17日 星期六

[程式] Android Studio : Simple Spin The Bottle Game

Android Studio : Simple Spin The Bottle Game

這個轉瓶子遊戲(Spin The Bottle Game)程式也算是簡單的範例,跟輪盤遊戲(Simple Roulette Game)差異不大,使用的主要是RotateAnimation,不過有多了一個還原功能(RESET),與程式內的 rotate.setFillAfter(false)有相同的效果,差異在於一個是手動還原一個是自動還原。
可以透過修改程式內的一些相關數值,產生順時針旋轉與逆時針旋轉的效果,這部分有興趣的人在玩玩看吧!


範例網址:

https://www.youtube.com/watch?v=YgOG62uPA5s&index=10&list=PL8h0boM9pEdRyn4bXj4qslAj5a3UzYdP_
範例相關圖片 ic_bottle.png 取自網路,為[不限使用權]圖片

相關資訊圖片:

Spin The Bottle View畫面
Android Studio : Simple Spin The Bottle Game
2018年3月14日 星期三

[程式] Android Studio : Simple Roulette Game

Android Studio : Simple Roulette Game

最近在撰寫Prize Wheel程式,在找尋資料的時候,發現了這個輪盤遊戲影片,對於學習Animation相當不錯,便實作了程式,並簡單補充了一些註解,方便閱讀。


範例網址:

https://www.youtube.com/watch?v=TPKugVdd6E4
範例相關圖片 ic_wheel.png 與 ic_pointer.png 取自網路

相關資訊圖片:

Roulette view畫面
Roulette view畫面
2018年2月2日 星期五

[程式] Android Studio : generate javadoc comments

Android Studio要產生javadoc comments,目前學到的有兩種方式,覺得使用上都還OK:
  1. Install JavaDoc plugin
  2. 直接輸入 /** + Enter
方式 1:
Settings
Android Studio : generate javadoc comments



















2018年1月27日 星期六

[程式] Android Studio 專案複製

Android Studio 專案複製

開發專案時,常需要複製專案當作備份或修改,Android Studio似乎跟Eclipse不太一樣,本例為所有相關名稱皆修改,因此步驟還不少,原始專案:ProjectCreate,複製專案:ProjectCopy,Package Name與APP Name都修改,詳細步驟請參考下列圖片。

備註說明:因Google相簿異常,圖片從相簿內消失,因此2014/04/15重新製作圖片並上傳Google相簿,因此Android Studio版本有變動,部分步驟有不同,操作時請參考備註說明。


相關資訊圖片:

開啟要備複製的專案
開啟要備複製的專案
2018年1月21日 星期日

[程式] Android Studio : Gradle error

Android Studio : Gradle error 透過Android Studio複習Android時,匯入Example時產生的錯誤訊息


Error:Minimum supported Gradle version is 4.1. Current version is 2.14.1. If using the gradle wrapper, try editing the distributionUrl in C:\Users\kingbow\AndroidStudioProjects\FragmentBasics\gradle\wrapper\gradle-wrapper.properties to gradle-4.1-all.zip


Consult IDE log for more details (Help | Show Log)