前言
為了使自己的app更加的有個人風(fēng)格,故在網(wǎng)上尋找了很多的參考資料,這里是對自己設(shè)計的總結(jié),具體機(jī)智云APP生成流程請參考我上一篇博客:基于stm32的連接機(jī)智云教程。
1、下載機(jī)智云開源APP
進(jìn)行以下操作之前請確保已經(jīng)在機(jī)智云中創(chuàng)建了一個產(chǎn)品,下面點擊添加應(yīng)用,選擇Android生成一個app應(yīng)用
然后按照提示,將密匙填入到相應(yīng)位置,具體參考我上一篇博客,點擊下載,將app工程下載到本地
2、Andriod方面處理
2.1 、AS軟件安裝與源碼修改
Android studio軟件安裝與源碼修改
將下載好了的文件解壓出來,然后將第二個文件夾復(fù)制出來,粘貼到存放Android studio文件例程文件夾中,若還沒有安裝Android studio的請參考這位大佬的詳細(xì)例程,這邊建議下載的Android studio版本不要太新,不然工程可能編譯不成功。
然后自己新建一個Android工程作為參考,方便修改源碼,
第一處參考新建例程修改機(jī)智云APP
將此處修改為對應(yīng)的新建工程的內(nèi)容
第二處按照此路徑參考新建工程修改,這里是我自己的按照自己的新建工程修改完畢的代碼
需注意這里的compile 均替換為implementation,testcompile均替換為testimplementation。
然后可以從Android studio里面打開修改好的機(jī)智云開源app,等待一段時間打開后,
2.2、修改APP圖標(biāo)和名稱
首先在網(wǎng)上下載相關(guān)素材備用,若大小不一,請自行修改圖片或者圖標(biāo)的大小。這時將我們下載好的圖標(biāo)或者圖片放置到桌面,然后分別復(fù)制一下,依次粘貼到drawable-xhdpi目錄下(注意鼠標(biāo)放在drawable-xhdpi上右擊選Paste便出現(xiàn)如下界面)
點擊確定,將此名稱復(fù)制到按照如下圖這個文件,紅框內(nèi)既是我們可以替換的app圖標(biāo),將你的圖標(biāo)名稱填上就ok,
2.3、修改啟動頁面和內(nèi)部UI
現(xiàn)在修改啟動界面,這里的圖片在前面我們已經(jīng)復(fù)制到了相關(guān)目錄下,現(xiàn)在可以按照下圖將紅框出修改成為你的圖片名稱,見下圖
然后在172行和174行兩處替換為你的設(shè)備離線圖標(biāo)
同樣是這個目錄下,在117行和119行相應(yīng)位置替換為自己的設(shè)備在線圖標(biāo)
2.4、修改設(shè)備監(jiān)控界面
這是我已經(jīng)修改好的界面UI,最后效果圖如下(這里的圖標(biāo)可自行修改為自己的圖標(biāo),若是僅僅復(fù)制代碼會報錯)
代碼如下所示,可根據(jù)需要自行修改(僅供參考,最好要讀懂代碼)
《?xml version=“1.0” encoding=“utf-8”?》《LinearLayout xmlns:android=“http://schemas.android.com/apk/res/android”android:layout_width=“match_parent”android:layout_height=“match_parent”android:orientation=“vertical”》
《include layout=“@layout/header_toolbar” /》
《ScrollViewandroid: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” 》
《LinearLayoutandroid:layout_width=“match_parent”android:layout_height=“wrap_content”android:orientation=“vertical”android:scrollbars=“vertical” 》《LinearLayoutandroid:layout_width=“match_parent”android:layout_height=“wrap_content”android:orientation=“horizontal”android:scrollbars=“horizontal” 》
《!-- 燈(布爾可寫) --》《RelativeLayoutandroid: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”》
《ImageViewandroid: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” /》
《TextViewandroid: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=“燈” /》
《Switchandroid: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=“關(guān)閉”android:textOn=“開啟” /》《/RelativeLayout》
《!-- 蜂鳴器(布爾可寫) --》《RelativeLayoutandroid:layout_width=“0dp”android:layout_weight=“3”android:layout_height=“wrap_content”android:layout_marginBottom=“1dp”android:background=“@color/white”android:padding=“10dp” 》
《ImageViewandroid: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” /》
《TextViewandroid: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=“蜂鳴器” /》
《Switchandroid: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=“關(guān)閉”android:textOn=“開啟” /》《/RelativeLayout》
《!-- 開關(guān)(布爾可寫) --》《RelativeLayoutandroid:layout_width=“0dp”android:layout_weight=“3”android:layout_height=“wrap_content”android:layout_marginBottom=“1dp”android:background=“@color/white”android:padding=“10dp” 》
《ImageViewandroid: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” /》《TextViewandroid: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=“開關(guān)” /》《Switchandroid: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=“關(guān)閉”android:textOn=“開啟” /》《/RelativeLayout》《/LinearLayout》
《LinearLayoutandroid:layout_width=“match_parent”android:layout_height=“101dp”android:orientation=“horizontal”android:scrollbars=“horizontal”》《!-- 溫度(數(shù)值只讀) --》《RelativeLayoutandroid:layout_width=“0dp”android:layout_weight=“3”android:layout_height=“wrap_content”android:background=“@color/white”android:padding=“10dp” 》
《ImageViewandroid: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” /》《TextViewandroid: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” /》《TextViewandroid: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=“℃” /》《TextViewandroid:id=“@+id/Temp_text1”android:layout_toLeftOf=“@id/Temp”android:layout_width=“wrap_content”android:layout_height=“match_parent”android:text=“溫度” /》
《/RelativeLayout》
《!-- 濕度(數(shù)值只讀) --》《RelativeLayoutandroid:layout_width=“0dp”android:layout_height=“wrap_content”android:layout_marginBottom=“1dp”android:layout_weight=“3”android:background=“@color/white”android:padding=“10dp”》《ImageViewandroid: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” /》《TextViewandroid: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=“%” /》《TextViewandroid: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” /》《TextViewandroid:id=“@+id/Shidu_text1”android:layout_toLeftOf=“@id/Shidu”android:layout_width=“wrap_content”android:layout_height=“match_parent”android:text=“濕度” /》《/RelativeLayout》
《!-- 光照強(qiáng)度(數(shù)值只讀) --》《RelativeLayoutandroid:layout_width=“0dp”android:layout_height=“wrap_content”android:layout_marginBottom=“1dp”android:layout_weight=“3”android:background=“@color/white”android:padding=“10dp”》
《ImageViewandroid: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” /》
《TextViewandroid: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=“l(fā)x” /》《TextViewandroid: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=“光強(qiáng)” /》《/RelativeLayout》《/LinearLayout》《!-- 溫度閾值范圍(數(shù)值可寫) --》《RelativeLayoutandroid:layout_width=“match_parent”android:layout_height=“wrap_content”android:layout_marginBottom=“1dp”android:background=“@color/white”android:padding=“10dp” 》
《TextViewandroid:layout_width=“wrap_content”android:layout_height=“match_parent”android:text=“溫度閾值范圍(℃)” /》
《TextViewandroid: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” /》
《LinearLayoutandroid: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”android:orientation=“horizontal” 》
《TextViewandroid: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” /》
《TextViewandroid:layout_width=“wrap_content”android:layout_height=“wrap_content”android:textSize=“16sp”android:text=“50” /》《/LinearLayout》
《/RelativeLayout》
《!-- 濕度閾值范圍(數(shù)值可寫) --》《RelativeLayoutandroid:layout_width=“match_parent”android:layout_height=“wrap_content”android:layout_marginBottom=“1dp”android:background=“@color/white”android:padding=“10dp” 》
《TextViewandroid:layout_width=“wrap_content”android:layout_height=“match_parent”android:text=“濕度閾值范圍(%)” /》
《TextViewandroid: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” /》
《LinearLayoutandroid: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”android:orientation=“horizontal” 》
《TextViewandroid:layout_width=“wrap_content”android:layout_height=“wrap_content”android:textSize=“16sp”android:text=“20” /》
《SeekBarandroid: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”
上一篇:單片機(jī)Fault遇到故障了應(yīng)該怎么辦
下一篇:MAXREFDES1154:4通道通用溫度測量(TC&RTD)方案
推薦閱讀最新更新時間:2025-07-11 03:35
設(shè)計資源 培訓(xùn) 開發(fā)板 精華推薦
- 使用 MagnaChip Semiconductor 的 MAP9010QNRH 的參考設(shè)計
- LT6654AHS6-3.3、16 位 ADC 電壓基準(zhǔn)的典型應(yīng)用
- AD8601ARTZ-REEL7 高端運算放大器電流監(jiān)視器的典型應(yīng)用
- MCP1501-20E/SN 2.048V ADC 示例電路的典型應(yīng)用電路
- ADR444B 4.096 Vout 超低噪聲、LDO XFET 電壓基準(zhǔn)的典型應(yīng)用,具有電流吸收器和電流源
- 使用 NXP Semiconductors 的 MC32BC3770CS 的參考設(shè)計
- LT1575 UltraFast 線性控制器打造快速瞬態(tài)響應(yīng)電源
- 使用 NXP Semiconductors 的 TDA3603P 的參考設(shè)計
- L78L12AC正壓穩(wěn)壓器高輸出電流短路保護(hù)的典型應(yīng)用
- OP184FSZ-REEL輸出過載恢復(fù)運放測試電路典型應(yīng)用
- Bourns 發(fā)布全新大功率金屬片電流檢測電阻, 采用 SMD 2010 緊湊型封裝
- 意法半導(dǎo)體推出先進(jìn)的 1600 V IGBT,面向高性價比節(jié)能家電市場
- EDPF-NT+分散控制系統(tǒng)網(wǎng)絡(luò)防護(hù)解決方案
- 基于PLC控制的易驅(qū)變頻器在布袋除塵器上的應(yīng)用
- 如何利用伺服自動化實現(xiàn)成本降低和產(chǎn)能最大化?
- 壓力傳感器有哪些抗干擾措施?
- 破局!補(bǔ)盲dToF固態(tài)激光雷達(dá)輪番“出手”,禾賽FT120也要靠邊
- 利用正壓送風(fēng)壓力傳感器自動控制火災(zāi)風(fēng)口壓力
- 多個傳感器間相互位置關(guān)系校準(zhǔn)方法
- 樓宇自控BA系統(tǒng)傳感器有哪些?
- STM32開發(fā)筆記6: Nucleo-64開發(fā)板簡介
- STM32開發(fā)筆記7: ST-LINK/V2-1驅(qū)動程序的安裝
- STM32開發(fā)筆記8: STM32CubeF0介紹
- STM32開發(fā)筆記9: STM32CubeF0固件架構(gòu)
- STM32開發(fā)筆記10: HAL_Init函數(shù)
- 不懼疫情,蘋果計劃2021年3月份前將iPhone產(chǎn)量提高4%
- 精工愛普生日本所有工廠停工
- 屏幕刷新率現(xiàn)在這么容易就突破了?努比亞Play 144Hz超競屏
- 晶訊再發(fā)濾波器新品,誓要打破美日壟斷
- 寶馬新技術(shù)旋轉(zhuǎn)OLED專利申請獲審批