標(biāo)題: android-studio詳細(xì)安裝步驟以及創(chuàng)建第一個(gè)項(xiàng)目 [打印本頁(yè)]
作者: bbxyliyang 時(shí)間: 2022-7-16 11:18
標(biāo)題: android-studio詳細(xì)安裝步驟以及創(chuàng)建第一個(gè)項(xiàng)目
1、首先我們?nèi)ス俜骄W(wǎng)站下載最新版的Android Studio,鏈接參考如下:
Download Android Studio and SDK tools | Android Developers
1.png (38.91 KB, 下載次數(shù): 79)
下載附件
2022-7-16 11:13 上傳
進(jìn)入網(wǎng)頁(yè)后,直接點(diǎn)擊網(wǎng)頁(yè)中心的“Download Android Studio
2、雙擊安裝軟件,打開(kāi)后點(diǎn)擊 Next 繼續(xù)下一步;
在安裝到第二步的時(shí)候,會(huì)出現(xiàn)以下界面
Android Virtual Device,是系統(tǒng)自帶模擬器,也可不用系統(tǒng)模擬器就不勾選,自己下載其他模擬器(這里我們勾選);
2.png (65.96 KB, 下載次數(shù): 81)
下載附件
2022-7-16 11:14 上傳
建議默認(rèn)安裝目錄,如果需要修改安裝目錄,可點(diǎn)擊 Browse…修改,點(diǎn)擊 Next 繼續(xù)下一步;(這里我們選擇默認(rèn)安裝目錄)
點(diǎn)擊 Install 安裝;
點(diǎn)擊 Next 繼續(xù)下一步;
點(diǎn)擊 Finish完成;
3、下載安裝完成后,我們打開(kāi)Android studio,會(huì)出現(xiàn)如下界面:
接下來(lái)選中“Empty Activity",點(diǎn)擊”Next“
3.png (51.48 KB, 下載次數(shù): 73)
下載附件
2022-7-16 11:14 上傳
接下來(lái)這個(gè)界面相信學(xué)習(xí)編程的都會(huì)很熟悉
4.png (47.26 KB, 下載次數(shù): 71)
下載附件
2022-7-16 11:14 上傳
其中Name就是項(xiàng)目名稱,需要注意名稱只能全英文。
Package 那么就是包的名稱,一般我都是選擇默認(rèn),不用管它。
Save location就是這個(gè)項(xiàng)目存儲(chǔ)的地方。
Language我這里選擇的是Java,還有一個(gè)Kotlin可供大家選擇,其他設(shè)置默認(rèn)即可,點(diǎn)擊Finish。稍等片刻,我們的項(xiàng)目就創(chuàng)建好了。
4、那么如何運(yùn)行我們的第一個(gè)項(xiàng)目呢,首先需要下載一個(gè)模擬器,點(diǎn)擊上方快捷菜單欄手機(jī)圖標(biāo)。
5.png (44.12 KB, 下載次數(shù): 69)
下載附件
2022-7-16 11:15 上傳
在這里可以選擇模擬器的信號(hào)和安卓版本,首先先創(chuàng)建一個(gè)新的模擬器
點(diǎn)擊最下角的Create Virtual Device...我們會(huì)進(jìn)入如下界面:
在這個(gè)界面可以選擇模擬器的型號(hào),需要注意的是,模擬器的型號(hào)和安卓版本的高低會(huì)影響下載的大小和響應(yīng)時(shí)長(zhǎng),在這里我建議配置較低的電腦選擇版本較低的模擬器和安卓版本。在這里我選擇的是Pixel 3 XL,點(diǎn)擊Next。
6.png (68.37 KB, 下載次數(shù): 91)
下載附件
2022-7-16 11:15 上傳
接下來(lái)我們會(huì)進(jìn)入這個(gè)界面,在左邊的多選框里我們選擇的是安卓版本,在這里我下載的是安卓7.0(Nougat),點(diǎn)擊Next。
7.png (86.16 KB, 下載次數(shù): 86)
下載附件
2022-7-16 11:15 上傳
進(jìn)入這個(gè)界面一般都是默認(rèn)設(shè)置直接點(diǎn)擊Finish,如果你想要模擬器橫屏的話可以選中Lanscape,這里我是默認(rèn)選中的Portrait,點(diǎn)擊Finish。
5、接下來(lái)我們會(huì)來(lái)到最初的模擬器下載界面,可以看到剛剛下載的模擬器已經(jīng)出現(xiàn)在列表里了。剛剛下載的Pixel 3 XL API 24 2后面有一個(gè)按鈕,點(diǎn)擊它就可以啟動(dòng)模擬器啦。稍等片刻,模擬器就啟動(dòng)成功了。
9.png (26.18 KB, 下載次數(shù): 84)
下載附件
2022-7-16 11:16 上傳
6、那么如何運(yùn)行經(jīng)典的Hello World的呢,其實(shí)這個(gè)項(xiàng)目在創(chuàng)建時(shí)已經(jīng)替我們寫好了,在activity_main.xml文件里。
10.png (69.65 KB, 下載次數(shù): 81)
下載附件
2022-7-16 11:16 上傳
7、我們只需要點(diǎn)擊快捷菜單欄的小錘子用來(lái)編譯項(xiàng)目,中間的下拉表是用來(lái)選擇運(yùn)行那個(gè)項(xiàng)目,通常app就是當(dāng)前的主項(xiàng)目,右邊的三角形按鈕是用來(lái)運(yùn)行項(xiàng)目的。
11.png (100.59 KB, 下載次數(shù): 78)
下載附件
2022-7-16 11:16 上傳
8、至此,第一個(gè)項(xiàng)目就完成了。
12.png (102.32 KB, 下載次數(shù): 78)
下載附件
2022-7-16 11:16 上傳
作者: bbxyliyang 時(shí)間: 2022-7-17 22:33
android studio將背景設(shè)置為黑色或者白色的方法
File------setting--------appearance&Behavior
選擇theme為Darcula就會(huì)變成黑色主題;
選擇intellij 會(huì)變成白色主題
作者: bbxyliyang 時(shí)間: 2022-7-18 15:44
今天我們來(lái)學(xué)習(xí)下,常見(jiàn)的界面布局:
1.png (57.19 KB, 下載次數(shù): 75)
下載附件
2022-7-18 15:41 上傳
1、線性布局(LinearLayout)主要以水平或垂直方式來(lái)顯示界面中的控件。當(dāng)控件水平排列時(shí),顯示順序依次為從左到右,當(dāng)控件垂直排列時(shí),顯示順序依次為從上到下。
2.png (21.28 KB, 下載次數(shù): 83)
下載附件
2022-7-18 15:42 上傳
<?xml version="1.0" encoding="utf-8"?><LinearLayout xmlns:android="http://schemas.android.com/apk/res/android"
xmlns:app="http://schemas.android.com/apk/res-auto"
xmlns:tools="http://schemas.android.com/tools"
android:layout_width="match_parent"
android:layout_height="match_parent"
android:orientation="vertical"
tools:context=".MainActivity">
<TextView
android:id="@+id/textView"
android:layout_width="match_parent"
android:layout_height="wrap_content"
android:text="Hello Wolrd!"
android:textColor="#00ff00"
android:textSize="28sp"
<Button
android:id="@+id/button"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:text="按鈕1"
android:textSize="28sp" />
<Button
android:id="@+id/button2"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:textSize="28sp"
android:text="按鈕2" />
<Button
android:id="@+id/button3"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:textSize="28sp"
android:text="按鈕3" />
</LinearLayout>
3.png (19.15 KB, 下載次數(shù): 78)
下載附件
2022-7-18 15:42 上傳
<?xml version="1.0" encoding="utf-8"?><LinearLayout xmlns:android="http://schemas.android.com/apk/res/android"
xmlns:app="http://schemas.android.com/apk/res-auto"
xmlns:tools="http://schemas.android.com/tools"
android:layout_width="match_parent"
android:layout_height="match_parent"
android:orientation="horizontal"
tools:context=".MainActivity">
<Button
android:id="@+id/button"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:text="按鈕1"
android:textSize="28sp" />
<Button
android:id="@+id/button2"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:textSize="28sp"
android:text="按鈕2" />
<Button
android:id="@+id/button3"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:textSize="28sp"
android:text="按鈕3" />
</LinearLayout>
4.png (10.35 KB, 下載次數(shù): 84)
下載附件
2022-7-18 15:43 上傳
LinearLayout布局中的android:layout_width屬性值不可設(shè)為wrap_content。這是因?yàn)?/font>LinearLayout的優(yōu)先級(jí)比Button高,如果設(shè)置為wrap_content,則Button控件的android:layout_weight屬性會(huì)失去作用。android:layout_weight的作用主要讓代碼適合不同的機(jī)型,我們按鈕1,按鈕2,按鈕3的layout_weight屬性分別設(shè)置成1,1,2,它的含義寬度分別為1/4,1/4,2/4整個(gè)屏幕寬度。
<?xml version="1.0" encoding="utf-8"?><LinearLayout xmlns:android="http://schemas.android.com/apk/res/android"
xmlns:app="http://schemas.android.com/apk/res-auto"
xmlns:tools="http://schemas.android.com/tools"
android:layout_width="match_parent"
android:layout_height="match_parent"
android:orientation="horizontal"
tools:context=".MainActivity">
<Button
android:id="@+id/button"
android:layout_width="0dp"
android:layout_height="wrap_content"
android:layout_weight="1"
android:layout_marginRight="10dp"
android:text="按鈕1"
/>
<Button
android:id="@+id/button2"
android:layout_width="0dp"
android:layout_height="wrap_content"
android:layout_weight="1"
android:layout_marginRight="10dp"
android:text="按鈕2" />
<Button
android:id="@+id/button3"
android:layout_width="0dp"
android:layout_height="wrap_content"
android:layout_weight="2"
android:text="按鈕3" />
</LinearLayout>
作者: bbxyliyang 時(shí)間: 2022-7-18 15:46
1.png (57.19 KB, 下載次數(shù): 89)
下載附件
2022-7-18 20:42 上傳
1、線性布局(LinearLayout)主要以水平或垂直方式來(lái)顯示界面中的控件。當(dāng)控件水平排列時(shí),顯示順序依次為從左到右,當(dāng)控件垂直排列時(shí),顯示順序依次為從上到下。
2.png (21.28 KB, 下載次數(shù): 86)
下載附件
2022-7-18 20:43 上傳
<?xml version="1.0" encoding="utf-8"?><LinearLayout xmlns:android="http://schemas.android.com/apk/res/android"
xmlns:app="http://schemas.android.com/apk/res-auto"
xmlns:tools="http://schemas.android.com/tools"
android:layout_width="match_parent"
android:layout_height="match_parent"
android:orientation="vertical"
tools:context=".MainActivity">
<TextView
android:id="@+id/textView"
android:layout_width="match_parent"
android:layout_height="wrap_content"
android:text="Hello Wolrd!"
android:textColor="#00ff00"
android:textSize="28sp"
<Button
android:id="@+id/button"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:text="按鈕1"
android:textSize="28sp" />
<Button
android:id="@+id/button2"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:textSize="28sp"
android:text="按鈕2" />
<Button
android:id="@+id/button3"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:textSize="28sp"
android:text="按鈕3" />
</LinearLayout>
3.png (19.15 KB, 下載次數(shù): 74)
下載附件
2022-7-18 20:43 上傳
<?xml version="1.0" encoding="utf-8"?><LinearLayout xmlns:android="http://schemas.android.com/apk/res/android"
xmlns:app="http://schemas.android.com/apk/res-auto"
xmlns:tools="http://schemas.android.com/tools"
android:layout_width="match_parent"
android:layout_height="match_parent"
android:orientation="horizontal"
tools:context=".MainActivity">
<Button
android:id="@+id/button"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:text="按鈕1"
android:textSize="28sp" />
<Button
android:id="@+id/button2"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:textSize="28sp"
android:text="按鈕2" />
<Button
android:id="@+id/button3"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:textSize="28sp"
android:text="按鈕3" />
</LinearLayout>
LinearLayout布局中的android:layout_width屬性值不可設(shè)為wrap_content。這是因?yàn)長(zhǎng)inearLayout的優(yōu)先級(jí)比Button高,如果設(shè)置為wrap_content,則Button控件的android:layout_weight屬性會(huì)失去作用。android:layout_weight的作用主要讓代碼適合不同的機(jī)型,我們按鈕1,按鈕2,按鈕3的layout_weight屬性分別設(shè)置成1,1,2,它的含義寬度分別為1/4,1/4,2/4整個(gè)屏幕寬度。
4.png (10.35 KB, 下載次數(shù): 72)
下載附件
2022-7-18 20:44 上傳
<?xml version="1.0" encoding="utf-8"?><LinearLayout xmlns:android="http://schemas.android.com/apk/res/android"
xmlns:app="http://schemas.android.com/apk/res-auto"
xmlns:tools="http://schemas.android.com/tools"
android:layout_width="match_parent"
android:layout_height="match_parent"
android:orientation="horizontal"
tools:context=".MainActivity">
<Button
android:id="@+id/button"
android:layout_width="0dp"
android:layout_height="wrap_content"
android:layout_weight="1"
android:layout_marginRight="10dp"
android:text="按鈕1"
/>
<Button
android:id="@+id/button2"
android:layout_width="0dp"
android:layout_height="wrap_content"
android:layout_weight="1"
android:layout_marginRight="10dp"
android:text="按鈕2" />
<Button
android:id="@+id/button3"
android:layout_width="0dp"
android:layout_height="wrap_content"
android:layout_weight="2"
android:text="按鈕3" />
</LinearLayout>
作者: 秋林津度 時(shí)間: 2023-7-5 09:35
學(xué)習(xí)到了,感謝
歡迎光臨 (http://m.zg4o1577.cn/bbs/) |
Powered by Discuz! X3.1 |
主站蜘蛛池模板:
福利视频二区
|
亚洲免费高清
|
91精品福利
|
国产在线播放av
|
欧美狠狠干
|
中文字幕av一区二区三区谷原希美
|
最新国产在线视频
|
激情综合网站
|
在线免费观看黄色片
|
国产成人99久久亚洲综合精品
|
国产不卡视频
|
日本不卡一区
|
中文字幕亚洲视频
|
国产区在线视频
|
国产一级片视频
|
国产无限资源
|
久久精品小视频
|
日韩精品视频在线播放
|
97精品国产露脸对白
|
www.色日本
|
中文字幕av一区二区三区
|
欧美一级淫片免费视频魅影视频
|
美女久久久久久
|
日本国产精品
|
日韩精品久久久久久久酒店
|
成人国产在线
|
久久久久毛片
|
99国产在线视频
|
另类ts人妖一区二区三区
|
国产主播精品
|
青青草免费在线观看视频
|
国产毛片视频
|
成人福利网|
福利一区福利二区
|
秋霞午夜鲁丝一区二区老狼
|
国产激情视频在线
|
午夜激情在线观看
|
午夜激情网
|
国产视频黄色
|
怡红院av|
国产精品成人免费视频
|