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

 找回密碼
 立即注冊

QQ登錄

只需一步,快速開始

搜索
查看: 1750|回復: 0
收起左側

基于機智云AIoT平臺的Android開源app修改教程

[復制鏈接]
ID:729078 發表于 2021-7-7 17:16 | 顯示全部樓層 |閱讀模式
為了使自己的app更加的有個人風格,因此在網上尋找了很多的參考資料,這里是對自己設計的總結,具體機智云APP生成流程請參考我上一篇博客:基于STM32的連接機智云教程。

一,下載機智云開源APP

進行以下操作之前請確保已經在機智云平臺中創建了一個產品,下面點擊添加應用,選擇Android生成一個app應用



然后按照圖片提示,將密匙填入到相應位置,具體參考我上一篇博客,點擊下載,將app工程下載到本地



2、Andriod方面處理

2.1 、AS軟件安裝與源碼修改

Android studio軟件安裝與源碼修改

將下載好了的文件解壓出來,然后將第二個文件夾復制出來,粘貼到存放Android studio文件例程文件夾中,若還沒有安裝Android studio的請參考這位大佬的詳細例程,這邊建議下載的Android studio版本不要太新,不然工程可能編譯不成功。


然后自己新建一個Android工程作為參考,方便修改源碼,
第一處參考新建例程修改機智云APP


將此處修改為對應的新建工程的內容


第二處按照此路徑參考新建工程修改,這里是我自己的按照自己的新建工程修改完畢的代碼



修改后如下圖所示,需注意這里的compile 均替換為implementation,testcompile均替換為testimplementation。


然后可以從Android studio里面打開修改好的機智云開源app,等待一段時間打開后如下圖所示,


這里我們打開工程視圖




2.2、修改APP圖標和名稱


首先在網上下載相關素材備用,若大小不一,請自行修改圖片或者圖標的大小。這時將我們下載好的圖標或者圖片放置到桌面,然后分別復制一下,依次粘貼到drawable-xhdpi目錄下(注意鼠標放在drawable-xhdpi上右擊選Paste便出現如下界面)





點擊確定,將此名稱復制到按照如下圖這個文件,紅框內既是我們可以替換的app圖標,將你的圖標名稱填上就ok,





下面在這個位置修改app名稱



2.3、修改啟動頁面和內部UI



現在修改啟動界面,這里的圖片在前面我們已經復制到了相關目錄下,現在可以按照下圖將紅框出修改成為你的圖片名稱,見下圖



然后在172行和174行兩處替換為你的設備離線圖標

同樣是這個目錄下,在117行和119行相應位置替換為自己的設備在線圖標

2.4、修改設備監控界面

下面修改一下設備監控界面,按照此路徑打開

這是我已經修改好的界面UI,最后效果圖如下(這里的圖標可自行修改為自己的圖標,若是僅僅復制代碼會報錯)




代碼如下所示,可根據需要自行修改(僅供參考,最好要讀懂代碼)




<?xml version="1.0"encoding="utf-8"?>
<LinearLayoutxmlns:android="http://schemas.android.com/apk/res/android"
android:layout_width="match_parent"
android:layout_height="match_parent"
androidrientation="vertical">

<includelayout="@layout/header_toolbar" />

<ScrollView
android:layout_width="match_parent"
android:layout_height="match_parent"
android:background="@color/background_color"
android:fadingEdge="vertical"
android:paddingBottom="10dp"
android:paddingTop="20dp"
android:scrollbars="vertical">

<LinearLayout
android:layout_width="match_parent"
android:layout_height="wrap_content"
androidrientation="vertical"
android:scrollbars="vertical">
<LinearLayout
android:layout_width="match_parent"
android:layout_height="wrap_content"
androidrientation="horizontal"
android:scrollbars="horizontal">


<!-- 燈(布爾可寫) -->
<RelativeLayout
android:layout_width="0dp"
android:layout_height="match_parent"
android:layout_marginBottom="1dp"
android:layout_weight="3"
android:alpha="1"
android:background="@color/white"
android:gravity="center_horizontal"
android:padding="10dp">

<ImageView
android:id="@+id/LED"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:layout_alignParentTop="true"
android:layout_centerHorizontal="true"
android:src="@drawable/led" />

<TextView
android:id="@+id/Led_text"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:layout_below="@+id/LED"
android:layout_centerHorizontal="true"
android:layout_centerVertical="true"
android:text="燈" />

<Switch
android:id="@+id/sw_bool_LED"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:layout_below="@id/Led_text"
android:layout_alignParentBottom="true"
android:layout_centerHorizontal="true"
android:textOff="關閉"
android:textOn="開啟" />
</RelativeLayout>


<!-- 蜂鳴器(布爾可寫) -->
<RelativeLayout
android:layout_width="0dp"
android:layout_weight="3"
android:layout_height="wrap_content"
android:layout_marginBottom="1dp"
android:background="@color/white"
android:padding="10dp" >

<ImageView
android:id="@+id/BEEP"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:layout_alignParentTop="true"
android:layout_centerHorizontal="true"
android:src="@drawable/beep"/>

<TextView
android:id="@+id/BEEP_text"
android:layout_width="wrap_content"
android:layout_height="match_parent"
android:layout_centerVertical="true"
android:layout_centerHorizontal="true"
android:layout_below="@+id/BEEP"
android:text="蜂鳴器" />

<Switch
android:id="@+id/sw_bool_BEEP"
android:layout_width="wrap_content"
android:layout_height="match_parent"
android:layout_below="@+id/BEEP_text"
android:layout_centerHorizontal="true"
android:layout_centerVertical="true"
android:textOff="關閉"
android:textOn="開啟" />
</RelativeLayout>


<!-- 開關(布爾可寫) -->
<RelativeLayout
android:layout_width="0dp"
android:layout_weight="3"
android:layout_height="wrap_content"
android:layout_marginBottom="1dp"
android:background="@color/white"
android:padding="10dp" >

<ImageView
android:id="@+id/LED1"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:layout_alignParentTop="true"
android:layout_centerHorizontal="true"
android:src="@drawable/kaiguan"/>
<TextView
android:id="@+id/LED1_text"
android:layout_width="wrap_content"
android:layout_height="match_parent"
android:layout_below="@+id/LED1"
android:layout_centerHorizontal="true"
android:layout_centerVertical="true"
android:text="開關" />
<Switch
android:id="@+id/sw_bool_LED1"
android:layout_width="wrap_content"
android:layout_height="match_parent"
android:layout_below="@+id/LED1_text"
android:layout_centerHorizontal="true"
android:layout_centerVertical="true"
android:textOff="關閉"
android:textOn="開啟" />
</RelativeLayout>
</LinearLayout>

<LinearLayout
android:layout_width="match_parent"
android:layout_height="101dp"
androidrientation="horizontal"
android:scrollbars="horizontal">
<!-- 溫度(數值只讀) -->
<RelativeLayout
android:layout_width="0dp"
android:layout_weight="3"
android:layout_height="wrap_content"
android:background="@color/white"
android:padding="10dp" >

<ImageView
android:id="@+id/Temp"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:layout_alignParentTop="true"
android:layout_centerHorizontal="true"
android:src="@drawable/wd" />
<TextView
android:id="@+id/tv_data_Temp"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:layout_below="@+id/Temp"
android:layout_centerHorizontal="true"
android:layout_centerVertical="true"/>
<TextView
android:layout_marginLeft="5dp"
android:id="@+id/Temp_text"
android:layout_below="@+id/Temp"
android:layout_toRightOf="@id/tv_data_Temp"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:text="℃" />
<TextView
android:id="@+id/Temp_text1"
android:layout_toLeftOf="@id/Temp"
android:layout_width="wrap_content"
android:layout_height="match_parent"
android:text="溫度" />

</RelativeLayout>


<!-- 濕度(數值只讀) -->
<RelativeLayout
android:layout_width="0dp"
android:layout_height="wrap_content"
android:layout_marginBottom="1dp"
android:layout_weight="3"
android:background="@color/white"
android:padding="10dp">
<ImageView
android:id="@+id/Shidu"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:layout_alignParentTop="true"
android:layout_centerHorizontal="true"
android:src="@drawable/sd" />
<TextView
android:layout_marginLeft="5dp"
android:id="@+id/Shidu_text"
android:layout_below="@+id/Shidu"
android:layout_toRightOf="@id/tv_data_Shidu"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:text="%" />
<TextView
android:id="@+id/tv_data_Shidu"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:layout_below="@+id/Shidu"
android:layout_centerHorizontal="true"
android:layout_centerVertical="true"/>
<TextView
android:id="@+id/Shidu_text1"
android:layout_toLeftOf="@id/Shidu"
android:layout_width="wrap_content"
android:layout_height="match_parent"
android:text="濕度" />
</RelativeLayout>


<!-- 光照強度(數值只讀) -->
<RelativeLayout
android:layout_width="0dp"
android:layout_height="wrap_content"
android:layout_marginBottom="1dp"
android:layout_weight="3"
android:background="@color/white"
android:padding="10dp">

<ImageView
android:id="@+id/GQ"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:layout_alignParentTop="true"
android:layout_centerHorizontal="true"
android:src="@drawable/sun" />

<TextView
android:id="@+id/GQ_text"
android:layout_marginLeft="5dp"
android:layout_below="@+id/GQ"
android:layout_toRightOf="@id/tv_data_GQ"
android:layout_width="wrap_content"
android:layout_height="match_parent"
android:text="lx" />
<TextView
android:id="@+id/tv_data_GQ"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:layout_below="@+id/GQ"
android:layout_centerHorizontal="true"
android:layout_centerVertical="true"/>
<TextView

android:id="@+id/GQ_text1"
android:layout_toLeftOf="@id/GQ"
android:layout_width="wrap_content"
android:layout_height="match_parent"
android:text="光強" />
</RelativeLayout>
</LinearLayout>
<!-- 溫度閾值范圍(數值可寫) -->
<RelativeLayout
android:layout_width="match_parent"
android:layout_height="wrap_content"
android:layout_marginBottom="1dp"
android:background="@color/white"
android:padding="10dp" >

<TextView
android:layout_width="wrap_content"
android:layout_height="match_parent"
android:text="溫度閾值范圍(℃)" />

<TextView
android:id="@+id/tv_data_Temp_AlarmScope"
android:layout_width="110dp"
android:layout_height="wrap_content"
android:layout_alignParentRight="true"
android:textSize="16sp"
android:gravity="end" />

<LinearLayout
android:layout_width="match_parent"
android:layout_height="wrap_content"
android:layout_below="@+id/tv_data_Temp_AlarmScope"
android:layout_marginTop="10dp"
android:gravity="center_vertical"
androidrientation="horizontal">

<TextView
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:textSize="16sp"
android:text="0" />

<SeekBar

android:id="@+id/sb_data_Temp_AlarmScope"
android:thumb="@drawable/bar1"
android:thumbOffset="0dp"
android:layout_width="0dp"
android:layout_height="wrap_content"
android:layout_weight="3"
android:max="50" />

<TextView
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:textSize="16sp"
android:text="50" />
</LinearLayout>

</RelativeLayout>


<!-- 濕度閾值范圍(數值可寫) -->
<RelativeLayout
android:layout_width="match_parent"
android:layout_height="wrap_content"
android:layout_marginBottom="1dp"
android:background="@color/white"
android:padding="10dp" >

<TextView
android:layout_width="wrap_content"
android:layout_height="match_parent"
android:text="濕度閾值范圍(%)" />

<TextView
android:id="@+id/tv_data_Shidu_AlarmScope"
android:layout_width="110dp"
android:layout_height="wrap_content"
android:layout_alignParentRight="true"
android:textSize="16sp"
android:gravity="end" />

<LinearLayout
android:layout_width="match_parent"
android:layout_height="wrap_content"
android:layout_below="@+id/tv_data_Shidu_AlarmScope"
android:layout_marginTop="10dp"
android:gravity="center_vertical"
androidrientation="horizontal">

<TextView
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:textSize="16sp"
android:text="20" />

<SeekBar
android:id="@+id/sb_data_Shidu_AlarmScope"
android:thumb="@drawable/bar"
android:thumbOffset="0dp"
android:layout_width="0dp"
android:layout_height="wrap_content"
android:layout_weight="3"
android:max="75"

android:progress="0"/>

<TextView
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:textSize="16sp"
android:text="95" />
</LinearLayout>

</RelativeLayout>


<!-- 光強閾值范圍(數值可寫) -->
<RelativeLayout
android:layout_width="match_parent"
android:layout_height="wrap_content"
android:layout_marginBottom="1dp"
android:background="@color/white"
android:padding="10dp" >

<TextView
android:layout_width="wrap_content"
android:layout_height="match_parent"
android:text="光強閾值范圍(lx)" />

<TextView
android:id="@+id/tv_data_GQ_AlarmScope"
android:layout_width="110dp"
android:layout_height="wrap_content"
android:layout_alignParentRight="true"
android:textSize="16sp"
android:gravity="end" />

<LinearLayout
android:layout_width="match_parent"
android:layout_height="wrap_content"
android:layout_below="@+id/tv_data_GQ_AlarmScope"
android:layout_marginTop="10dp"
android:gravity="center_vertical"
androidrientation="horizontal">

<TextView
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:textSize="16sp"
android:text="0" />

<SeekBar

android:id="@+id/sb_data_GQ_AlarmScope"
android:thumb="@drawable/bar2"
android:thumbOffset="0dp"
android:layout_width="0dp"
android:layout_height="wrap_content"
android:layout_weight="3"
android:max="65535" />

<TextView
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:textSize="16sp"
android:text="65535" />
</LinearLayout>

</RelativeLayout>


</LinearLayout>

</ScrollView>
</LinearLayout>




2.5、安裝軟件

因為我們的程序編譯無錯誤,故開始安裝app,用數據線將電腦和手機連接,進入手機的開發者模式,打開開發者模式,允許進行USB調試





然后在android studio端點擊運行,app便安裝成功了











原文轉載于:https://blog.csdn.net/Zgc6666/article/details/104187111

回復

使用道具 舉報

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

本版積分規則

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

Powered by 單片機教程網

快速回復 返回頂部 返回列表
主站蜘蛛池模板: 日韩一二区| 精品综合网 | 国产精品美女久久久 | 亚洲资源站 | 国产精品日日摸夜夜添夜夜av | 欧美乱人伦视频 | 91精品国产91久久综合桃花 | 在线国产一区 | 中文字幕亚洲一区二区三区 | 成人欧美一区二区三区 | 精品久久国产老人久久综合 | 精品一区二区在线观看 | 艹逼网 | 欧美三级视频 | 亚洲免费在线 | 午夜激情一区 | 久久国产精品久久 | 亚洲网站在线观看 | 精品亚洲一区二区三区 | 欧美视频1区 | 麻豆毛片| jizz18国产 | 中文在线播放 | 免费99视频 | 国产精品一级 | 成人网址在线观看 | 日本不卡在线观看 | 精品综合| 久久久久久九九九九九九 | av黄色免费 | 国产精品久久久久久久久久妇女 | 伊人影院在线观看 | 欧美精品一区二区三区在线 | 一区二区三区高清在线观看 | 在线观看免费av网 | 成人在线免费网站 | 99精品免费久久久久久久久日本 | 亚洲成年人免费网站 | 国产精品美女久久久久久免费 | 日韩欧美在线一区 | 成人av播放 |