Android教程網
  1. 首頁
  2. Android 技術
  3. Android 手機
  4. Android 系統教程
  5. Android 游戲

Android 基本設定、ADB 與常見版面配置

編輯:關於 Android 程式設計

本文整理 Android 初學者常碰到的基礎設定、ADB 指令、專案結構、常用版面與單位概念,適合作為入門速查。

SDK 與工具

SDK 中常見 docs、platforms、platform-tools、samples、tools。platform-tools 內有 aapt、adb、dx 等工具;tools 內有 android、emulator、ddms 等。

ADB 常用指令

adb devices
adb -s emulator-5554 logcat
adb pull /sdcard/aa.txt c:\aa.txt
adb push aa.txt /mnt/sdcard/aa.txt
adb kill-server
adb start-server

專案結構

assets 放置不會產生 R 參照的資源;res 為資源目錄;src 為 Java 原始碼;AndroidManifest.xml 描述包名、版本、元件與權限。

版面與單位

常見版面包含 LinearLayout、RelativeLayout、FrameLayout、TableLayout 等。dp 或 dip 適合尺寸,sp 適合文字大小,可避免不同螢幕密度造成排版問題。

Logcat

Log.v、Log.d、Log.i、Log.w、Log.e 分別代表不同層級,搭配 tag 可快速篩選除錯資訊。

撥號範例中,可用 Intent 的 ACTION_CALL 搭配 tel URI,但必須加入 CALL_PHONE 權限,否則會出現 SecurityException。

  1. 上一篇文章:
  2. 下一篇文章:
Copyright © Android教程網 All Rights Reserved