久久久久久久999_99精品久久精品一区二区爱城_成人欧美一区二区三区在线播放_国产精品日本一区二区不卡视频_国产午夜视频_欧美精品在线观看免费

 找回密碼
 立即注冊

QQ登錄

只需一步,快速開始

搜索
查看: 3742|回復: 4
打印 上一主題 下一主題
收起左側

android-studio詳細安裝步驟以及創建第一個項目

[復制鏈接]
跳轉到指定樓層
樓主
1、首先我們去官方網站下載最新版的Android Studio,鏈接參考如下:
Download Android Studio and SDK tools  |  Android Developers
進入網頁后,直接點擊網頁中心的“Download Android Studio
2、雙擊安裝軟件,打開后點擊 Next 繼續下一步;
在安裝到第二步的時候,會出現以下界面
Android Virtual Device,是系統自帶模擬器,也可不用系統模擬器就不勾選,自己下載其他模擬器(這里我們勾選);
建議默認安裝目錄,如果需要修改安裝目錄,可點擊 Browse…修改,點擊 Next 繼續下一步;(這里我們選擇默認安裝目錄)
點擊 Install 安裝;
點擊 Next 繼續下一步;
點擊 Finish完成;
3、下載安裝完成后,我們打開Android studio,會出現如下界面:
接下來選中“Empty Activity",點擊”Next“

接下來這個界面相信學習編程的都會很熟悉
其中Name就是項目名稱,需要注意名稱只能全英文。
Package 那么就是包的名稱,一般我都是選擇默認,不用管它。
Save location就是這個項目存儲的地方。
Language我這里選擇的是Java,還有一個Kotlin可供大家選擇,其他設置默認即可,點擊Finish。稍等片刻,我們的項目就創建好了。
4、那么如何運行我們的第一個項目呢,首先需要下載一個模擬器,點擊上方快捷菜單欄手機圖標。


在這里可以選擇模擬器的信號和安卓版本,首先先創建一個新的模擬器
點擊最下角的Create Virtual Device...我們會進入如下界面:
在這個界面可以選擇模擬器的型號,需要注意的是,模擬器的型號和安卓版本的高低會影響下載的大小和響應時長,在這里我建議配置較低的電腦選擇版本較低的模擬器和安卓版本。在這里我選擇的是Pixel 3 XL,點擊Next。
   接下來我們會進入這個界面,在左邊的多選框里我們選擇的是安卓版本,在這里我下載的是安卓7.0(Nougat),點擊Next。

進入這個界面一般都是默認設置直接點擊Finish,如果你想要模擬器橫屏的話可以選中Lanscape,這里我是默認選中的Portrait,點擊Finish。

5、接下來我們會來到最初的模擬器下載界面,可以看到剛剛下載的模擬器已經出現在列表里了。剛剛下載的Pixel 3 XL API 24 2后面有一個按鈕,點擊它就可以啟動模擬器啦。稍等片刻,模擬器就啟動成功了。
6、那么如何運行經典的Hello World的呢,其實這個項目在創建時已經替我們寫好了,在activity_main.xml文件里。


7、我們只需要點擊快捷菜單欄的小錘子用來編譯項目,中間的下拉表是用來選擇運行那個項目,通常app就是當前的主項目,右邊的三角形按鈕是用來運行項目的。
8、至此,第一個項目就完成了。

評分

參與人數 1黑幣 +50 收起 理由
admin + 50 共享資料的黑幣獎勵!

查看全部評分

分享到:  QQ好友和群QQ好友和群 QQ空間QQ空間 騰訊微博騰訊微博 騰訊朋友騰訊朋友
收藏收藏1 分享淘帖 頂 踩
回復

使用道具 舉報

沙發
ID:190577 發表于 2022-7-17 22:33 | 只看該作者
android studio將背景設置為黑色或者白色的方法
File------setting--------appearance&Behavior
選擇theme為Darcula就會變成黑色主題;
選擇intellij 會變成白色主題
回復

使用道具 舉報

板凳
ID:190577 發表于 2022-7-18 15:44 | 只看該作者
今天我們來學習下,常見的界面布局:

1、線性布局(LinearLayout)主要以水平或垂直方式來顯示界面中的控件。當控件水平排列時,顯示順序依次為從左到右,當控件垂直排列時,顯示順序依次為從上到下。
<?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>
<?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屬性值不可設為wrap_content。這是因為LinearLayout的優先級比Button高,如果設置為wrap_content,則Button控件的android:layout_weight屬性會失去作用。android:layout_weight作用主要讓代碼適合不同的機型,我們按鈕1,按鈕2,按鈕3layout_weight屬性分別設置成1,1,2,它的含義寬度分別為1/4,1/4,2/4整個屏幕寬度。
<?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>
回復

使用道具 舉報

地板
ID:190577 發表于 2022-7-18 15:46 | 只看該作者



1、線性布局(LinearLayout)主要以水平或垂直方式來顯示界面中的控件。當控件水平排列時,顯示順序依次為從左到右,當控件垂直排列時,顯示順序依次為從上到下。
<?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>

<?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屬性值不可設為wrap_content。這是因為LinearLayout的優先級比Button高,如果設置為wrap_content,則Button控件的android:layout_weight屬性會失去作用。android:layout_weight的作用主要讓代碼適合不同的機型,我們按鈕1,按鈕2,按鈕3的layout_weight屬性分別設置成1,1,2,它的含義寬度分別為1/4,1/4,2/4整個屏幕寬度。

<?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>

回復

使用道具 舉報

5#
ID:1087282 發表于 2023-7-5 09:35 | 只看該作者
學習到了,感謝
回復

使用道具 舉報

您需要登錄后才可以回帖 登錄 | 立即注冊

本版積分規則

手機版|小黑屋|51黑電子論壇 |51黑電子論壇6群 QQ 管理員QQ:125739409;技術交流QQ群281945664

Powered by 單片機教程網

快速回復 返回頂部 返回列表
主站蜘蛛池模板: 国产精品一区二区视频 | 精品国产99 | 电影91久久久 | 久久久久久久久一区 | 中文字幕国产视频 | 欧美v免费 | 五月天综合网 | 亚洲人成人一区二区在线观看 | 国产综合精品一区二区三区 | 日韩精品一区二区三区老鸭窝 | 婷婷毛片| 本道综合精品 | 天天久久 | 日韩免费成人av | 国产高清毛片 | 天天天操| 亚洲成人自拍 | 欧美成人精品一区二区男人看 | 久久久国产视频 | 午夜久久久 | 九九久久这里只有精品 | 国产精品99久久久久久宅男 | 一区二区三区国产好的精 | 成人久久18免费网站 | 天堂中文在线播放 | 超碰成人免费 | 2021狠狠干| 精品视频一区二区三区在线观看 | 色婷婷av777 av免费网站在线 | av三级| 亚洲精品视频在线观看视频 | 欧美黄色一区 | 亚洲精品黑人 | 91欧美精品成人综合在线观看 | 国产精品1区 | 日日艹夜夜艹 | 91久久精品 | 欧美色成人 | 狠狠狠色丁香婷婷综合久久五月 | 99re在线视频观看 | 在线视频 欧美日韩 |