# 2019/0312/安卓系統\_開發基礎介紹

## 基礎

![](/files/-L_j_kxemZdwgfM9HJkj)

可註解在開發者文件中 readme.md &#x20;

![](/files/-L_jjcc-tQLRXI-svU7K)

![](/files/-L_jjnSzSaV-gVL8dtKr)

![](/files/-L_jjrkL76Qs385y9FCj)

是由一堆套件部屬而成要先等整體部屬完成最下面顯示finish才算完成

package name 必須是小寫 且符合規則 不然容易出錯

名稱對應根目錄對應到相對應的資料夾 更改時必須了解不然會出錯

![](/files/-L_jq-W8My-1yCOk3IXM)

功能 : java 資料夾 一個activity 對應一個 畫面 對應 java名稱 顯示哪個 layout

畫面 : res 資料夾layout name 套用某個版面的布局 xml&#x20;

### 畫面 與 功能 拆開

像是 mvc 架構

![](/files/-L_jrPZw_65H8tbGLnYB)

這版多了generatedjava 多了clean功能

![](/files/-L_jrnt66Nl9p83-m80t)

![](/files/-L_js97mK9x9_zPIkCJJ)

安卓 studio 的建置系統 gradle scripts 底層內容盡量不要動 前期gui所設定的東西都在這

![](/files/-L_jtNYNpcFjUwyFW9uQ)

可以一個組態但建置到不同的客戶端

###

###

###

###

### 安裝問題排解

![](/files/-L_juI-Yp6jMJTZHLm6x)

![](/files/-L_juWPJVOXtchMmviqP)

![](/files/-L_judJkTSJYOhBbs2XJ)

MainActivity.java

```
package com.example.myapplication;

import android.support.v7.app.AppCompatActivity;
import android.os.Bundle;

public class MainActivity extends AppCompatActivity {

    @Override
    protected void onCreate(Bundle savedInstanceState) {
        super.onCreate(savedInstanceState);
        setContentView(R.layout.activity_main);
    }
}

```

啟動功能

按下play 時 自動包裝 apk 並啟動 顯示 xml 內容

![](/files/-L_jw0Ura_uiGDEz6VxU)

![設計模式有時會有錯誤因為也是套件出來的(拖拉動作轉為程式碼)所以盡量用code模式](/files/-L_jw9WA0wJckptSguUV)

設定iee字型大小 file seting

![](/files/-L_jwuutImGZ_PQ491Qs)

前綴除了app與安卓標籤，tool標籤 可以刪除有時會有錯誤 套件的功能

```
 xmlns:tools="http://schemas.android.com/tools"
 tools:context=".MainActivity">
```

textview套件

![](/files/-L_jxiBIZ6lJlnEts-Cl)

顯示畫面調整

![](/files/-L_jxqHCOv6IgJz2rhv0)

實際文件 藍圖

![](/files/-L_jyDrRGEZ-BZGozvXy)

#### 還可整合 夜神 bluexxx&#x20;

```
   app:layout_constraintBottom_toBottomOf="parent"
   app:layout_constraintLeft_toLeftOf="parent"
   app:layout_constraintRight_toRightOf="parent"
   app:layout_constraintTop_toTopOf="parent" />
```

控制 layout位置

### 相對單位

圖片dp

字sp&#x20;

## XML

### 樹根  容器

![](/files/-L_kJZsOZrNbaES_ySCI)

![](/files/-L_kJhTa6Pe7rfZIc66e)

![](/files/-L_kLJToq9c77lss5DKA)

![](/files/-L_kMVXwIupUDX6N_B5A)

![](/files/-L_kMaDsCo0AzXmVEX7o)

![](/files/-L_kMgO_djj2qUhDsa3m)

### xml 檔案不可用 大寫英文、數字開頭

![](/files/-L_kQlaoaQ1hWziG-VXb)

### 實體手機開發

{% embed url="<https://jingyan.baidu.com/article/8065f87f4b919923312498c3.html>" %}

開發人員選項

{% embed url="<https://www.laird.tw/2017/03/usb-adb-interface-driver-error.html>" %}

usb 2.0 3.0 問題

裝置管理員查看 adb

![](/files/-L_kaDWDI0iwVLYywQNT)

成功囉


---

# Agent Instructions: Querying This Documentation

If you need additional information that is not directly available in this page, you can query the documentation dynamically by asking a question.

Perform an HTTP GET request on the current page URL with the `ask` query parameter:

```
GET https://johch3n611u.gitbook.io/c50108/ju-li-cheng-bei/201903/20190312-an-zhuo-xi.md?ask=<question>
```

The question should be specific, self-contained, and written in natural language.
The response will contain a direct answer to the question and relevant excerpts and sources from the documentation.

Use this mechanism when the answer is not explicitly present in the current page, you need clarification or additional context, or you want to retrieve related documentation sections.
