[ 初學 ]
[ 快速鍵 / 熱鍵 / Shortcuts ]
- Android Studio - Keyboard Shortcuts
- 註解
- 單行註解 : Ctrl + /
- 多行註解 : Ctrl + Shift + /
- [Android Studio] 1-7 註解快捷鍵 @ 給你魚竿
- 搜尋
- 單檔搜尋 : Ctrl + F
- 進街搜尋 : Ctrl + Shift + F
- [Android Studio] 1-4 搜尋功能 @ 給你魚竿
- 快速添加 override 或者 implements 方法
- 右键(或者Alt + Insert)→ Generate → Override Method... 或 Implement Method...
- 如果是要Override,可用:Ctrl + O
[ SDK (Software Development Kit / 軟體開發套件) ]
- 指定路徑 :
- 在安裝 Android Studio 過程中指定 (Android SDK Installation Location)
- 打開 SDK Manager : 點擊 Android Studio 上方的選單, Tools → Android → SDK Manager
- Reference
[ 調校 / Debug ]
- AndroidStudio應用調試技巧 - 壹讀
- Logcat - Logcat is a command-line tool that dumps a log of system messages.
- Logcat Command-line Tool | Android Studio
- 在 Android Studio 下方的 Android Monitor 裡面有。
- Log Class
- 可用來做程式追蹤及Debug,不會顯示在程式上。
- 當程式執行後,可在 Logcat 看到。
- [Android] 2-9 Log的介紹和使用 @ 給你魚竿
- 昭佑.天翔: Android 程式利用 LogCat 進行 Debug Log 顯示
- Log | Android Developers
- System.out.println("Message");
- 一樣在 Logcat 顯示
- 種類為 I (information),Tag 標籤為 : System.out
- 小紅點除錯
- 在程式的行號旁邊點下去,會出現一個紅點
- 執行時,點 'Debug' (不是 'Run'),執行到紅點就會停住
- Pushu Chang: [android] Android Studio 偵錯模式之讓人欲罷不能的小紅點
[ Gradle ]
- Android Studio系列教程四--Gradle基础 - stormzhang - 剛文章中有列出 Android Studio 和 Gradle 相關的部分
Gradle是一种依赖管理工具,基于Groovy语言,面向Java应用为主,它抛弃了基于XML的各种繁琐配置,取而代之的是一种基于Groovy的内部领域特定(DSL)语言。 - 使用Gradle管理你的Android Studio工程 | 飞雪无情的博客
Gradle 是一个基于Ant和Maven概念的项目自动化建构工具。它使用一种基于Groovy的特定领域语言(DSL)来声明项目设置,这比我们的ANT使用XML构建配置要灵活的多。在编写配置时,你可以像编程一样灵活,Gradle是基于Groovy的DSL语言,完全兼容JAVA - Configure Your Build | Android Studio
- 認識 Gradle 專案建置自動化工具 - iT 邦幫忙
Gradle 簡單說就是 Java 世界的 Makefile,它可以幫忙打理那些在專案開發過程中的瑣事,舉凡編譯、測試、檢查程式碼、產生文件、清理或壓縮檔案、上傳、發佈、重新啟動伺服器到送出電子郵件,都可以利用 Gradle 撰寫的 Script 來自動完成作業。 - 使用 Gradle 自動化建置 Java 專案(一) - iT 邦幫忙
Gradle 是用途廣泛的建置工具,但最重要的一點,就是非常適合處理 Java 專案,它讓 Java 專案自動化建置(Build Automation)變得更容易上手。 - 深入理解Android(一):Gradle详解
Gradle是一个工具,同时它也是一个编程框架。使用这个工具可以完成app的编译打包等工作。当然你也可以用它干其他的事情。
[ 啟動另一個 Activity / Start Another Activity ]
- Start Another Activity | Android Developers
- 在 OnClick 事件中
宣告 Intent intent = new Intent(this, AnotherActivity.class);
然後呼叫 startActivity(intent); - 若要傳遞資訊過去,可以使用 intent.putExtra();
[ Style & Themes ]
- 基本的 style 檔案在 res/values/styles.xml
- 可以指定 View 或 Activity 的外觀及格式的屬性集合
- for Application (all Activitys) :
<!-- AndroidManifest.xml --> <application android:theme="@style/CustomTheme">
- for Activity :
<!-- Activity.xml --> <activity android:theme="@android:style/Theme.Dialog">
- for View
<!-- Activity.xml 的 View --> <TextView style="@style/CodeFont" android:text="@string/hello" />
- for Application (all Activitys) :
- 样式和主题 | Android Developers
- 如何在Android Studio設計並套用自己的Theme - 綠豆湯
- 菜園角耕耘田地: [Android] Styles and Themes 設定
[ Activity 模板(Template) ]
- 神奇的Android Studio Template - Hongyang - 博客频道 - CSDN.NET
- Android Studio自定义模板 写页面竟然可以如此轻松 - Hongyang - 博客频道 - CSDN.NET
[ 材料設計 / Material Design ]
- Android 材料設計 | Android Developers
- Android开发:怎么把APP升级为MaterialDesign风格? - 简书
- 整理了一份超详尽的Material Design 学习笔记,送给你! - 简书
[ Property - Constraints & ConstraintLayout ]
- 使用 ConstraintLayout 来设计 View - 简书
- Build a Responsive UI with ConstraintLayout | Android Developers
- ConstraintLayout | Android Developers
- Error : This view is not constrained.
- 發生 : 當拉一個元件到畫面,但不是放在 Layouts 元件中 ,會出現該Error。
- 問題 : 若沒解決,執行時,該元件會定位在 (0,0) 的位置。
- 原因 : 沒有設定 Constraints。
在 [ Build a Responsive UI with ConstraintLayout | Android Developers ] 有提到 : To define a view's position in ConstraintLayout, you must add at least one horizontal and one vertical constraint for the view. - 快速解決方法 : 在畫面設計中,選擇Design頁面,在元件上點右鍵,選擇 [ Constraint Layout → Infer Constraints ],將會自動設定相關的Constraints。
[ app bar / action bar / tool bar ]
- (圖片來源 : Android Developer)
- Reference
- 右邊三個點的 menu list
- 覆寫 Activity 中的 onOptionsItemSelected 方法,
- 手動編碼
@Override public boolean onCreateOptionsMenu(Menu menu) { menu.add("Item1"); menu.add("Item2"); return super.onCreateOptionsMenu(menu); }
- 使用 menu.xml,
- 如果沒 res/menu/menu.xml,可以自己創建。
>> new -> Android Resource Directory,Resource Type 選 menu,這樣就有資料夾,然後再自己新增 menu.xml - menu.xml 內容參考如下
<menu xmlns:android="http://schemas.android.com/apk/res/android" xmlns:app="http://schemas.android.com/apk/res-auto"> <item android:id="@+id/action" android:title="@string/Item1" app:showAsAction="always" /> </menu>
- 編碼
public boolean onCreateOptionsMenu(Menu menu) { MenuInflater inflater = getMenuInflater(); inflater.inflate(R.menu.menu,menu); return true; }
- 參考 : android - menu directory is missing - Stack Overflow
- 如果沒 res/menu/menu.xml,可以自己創建。
- 手動編碼
- GiveMePasS's Android惡補筆記: 如何使用Menu
- 覆寫 Activity 中的 onOptionsItemSelected 方法,
- 老灰鴨的筆記本: 【Android】ActionBar 加入返回鍵 (左邊)
- Android ActionBar-左上角icon设置和事件配置 <3> - MMLoveMeMM - 博客园
[ Navigation Drawer / 隱藏式側選單 ]
- 在畫面左邊顯示 app 的瀏覽選項
- Creating a Navigation Drawer | Android Developers
- Tony Blog: 使用 Android Navigation Drawer 製作側選單 (1)
- [Android] Toolbar + 套用Navigation Drawer « Big O(1)
文章標籤
全站熱搜
留言列表