Android工程師入門(一)——這周入大門,擠時間,輕噴,android工程師
擠擠時間,入個門先。
一、環境搭建
略。
二、項目結構
在studio中,項目=Module;
res:放置應用到的所有資源——基本決定了產生的APK的大小;
java:java來源程式;
manifests:資訊清單檔,所有配置的情況,每次執行的第一個訪問地方;
--res
drawable:存放圖片資源;
layout:布局;
menu:菜單專屬布局;
mipmap:Mipmaps早在Android2.2+就可以用了,但是直到4.3 google才強烈建議使用。把圖片放到mipmaps可以提高系統渲染圖片的速度,提高圖片品質,減少GPU壓力;
values:存放字串,主題,顏色,樣式;
三、在介面中輸入以及顯示文字
3.1 控制項概述
TextView:顯示文字框控制項;
EditText:輸入文字框;
--常用屬性
android:id——控制項的id;
android:layout_width——空間的寬度;
~height;
~text——常值內容;
~textSize——文字大小;
~textColor;
~background;
EditText還多兩個:~hint輸入提示文本;inputType輸入文本類型
3.2 實現
在layout中的main.xml中
<!-- wrap_content:包含實際常值內容 match_parent:當前控制項鋪滿父類容器 fill_parent:同上,針對低版本的sdk-->
<TextView android:id="@+id/textView1" android:layout_width="wrap_content" android:layout_height="match_parent" android:text="姓名:" android:textSize="28sp" android:textColor="#000000" /> <EditText android:hint="請輸入你的姓名" android:id="@+id/editText1" android:layout_width="match_parent" android:layout_height="match_parent" />