智能家居APP设计(后序优化)

智能家居APP设计

在这里插入图片描述

在这里插入图片描述

welcome页面代码

package com.example.myapplication;

import androidx.annotation.NonNull;
import androidx.appcompat.app.AppCompatActivity;

import android.content.Intent;
import android.os.Bundle;
import android.os.Handler;
import android.os.Message;
import android.widget.TextView;

public class Welcom extends AppCompatActivity {

    Handler h;
    @Override
    protected void onCreate(Bundle savedInstanceState) {
        super.onCreate(savedInstanceState);
        setContentView(R.layout.activity_welcom1);
        TextView tx=findViewById(R.id.textView);

        h=new Handler(){

            @Override
            public void handleMessage(@NonNull Message msg) {
                super.handleMessage(msg);
                tx.setText(msg.what+"s");
            }
        };



        new Thread(new Runnable() {
            @Override
            public void run() {
                for(int i=5;i>0;i--){
                        Message msg=new Message();
                        msg.what=i;
                        h.sendMessage(msg);
                    try {
                        Thread.sleep(1000);
                    } catch (InterruptedException e) {
                        e.printStackTrace();
                    }
                }
                Intent in=new Intent(Welcom.this,MainActivity.class);
                startActivity(in);
            }
        }).start();
    }
}

页面

<?xml version="1.0" encoding="utf-8"?>
<RelativeLayout 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:background="@drawable/welcome"
    tools:context=".Welcom">

    <TextView
        android:id="@+id/textView"

        android:layout_width="wrap_content"
        android:layout_height="wrap_content"

        android:layout_alignParentRight="true"
        android:layout_margin="25dp"
        android:textColor="#000000"
        android:textSize="30dp"

        app:layout_constraintEnd_toStartOf="parent"
        app:layout_constraintStart_toStartOf="parent"
        app:layout_constraintTop_toTopOf="parent"></TextView>

</RelativeLayout>

主代码

package com.example.myapplication;

import androidx.appcompat.app.AppCompatActivity;

import android.os.Bundle;
import android.webkit.WebView;
import android.webkit.WebViewClient;

public class MainActivity extends AppCompatActivity {

    @Override
    protected void onCreate(Bundle savedInstanceState) {
        super.onCreate(savedInstanceState);
        setContentView(R.layout.activity_main);

        WebView wb=(WebView)findViewById(R.id.wd);
        wb.loadUrl("https://www.baidu.com/");
        wb.setWebViewClient(new WebViewClient());
    }
}

页面

<?xml version="1.0" encoding="utf-8"?>
<RelativeLayout 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:background="@drawable/bg"
    tools:context=".MainActivity">


    <WebView
        android:id="@+id/wd"
        android:layout_width="330dp"
        android:layout_height="200dp"
        android:layout_marginTop="165dp"
        android:layout_marginLeft="20dp"
        />
    <LinearLayout
        android:id="@+id/li"
        android:layout_below="@id/wd"
        android:layout_width="200dp"
        android:layout_centerInParent="true"
        android:orientation="horizontal"
        android:layout_height="130dp"
        android:layout_centerHorizontal="true"
        >
        <LinearLayout
            android:layout_weight="1"
            android:layout_width="0dp"
            android:layout_height="130dp"
            android:orientation="vertical"


            >

            <TextView
                android:layout_width="wrap_content"
                android:layout_height="wrap_content"
                android:layout_weight="1"
                android:text="温度:"
                android:textColor="#ffffff"
                android:textSize="20dp">

            </TextView>

            <TextView
                android:layout_width="wrap_content"
                android:layout_height="wrap_content"
                android:text="湿度:"
                android:textColor="#ffffff"
                android:textSize="20dp"
                android:layout_weight="1"
                >

            </TextView>
            <TextView
                android:layout_width="wrap_content"
                android:layout_height="wrap_content"
                android:text="火警:"
                android:textColor="#ffffff"
                android:layout_weight="1"
                android:textSize="20dp"
                >

            </TextView>
        </LinearLayout>
        <LinearLayout
            android:layout_weight="1"
            android:layout_width="0dp"
            android:layout_height="130dp"
            android:orientation="vertical"
            >
            <TextView
                android:layout_width="wrap_content"
                android:layout_height="wrap_content"
                android:layout_weight="1"
                android:text="40℃"
                android:textColor="#ffffff"
                android:textSize="20dp">

            </TextView>

            <TextView
                android:layout_width="wrap_content"
                android:layout_height="wrap_content"
                android:text="98%"
                android:textColor="#ffffff"
                android:textSize="20dp"
                android:layout_weight="1"
                >

            </TextView>
            <TextView
                android:layout_width="wrap_content"
                android:layout_height="wrap_content"
                android:text="监视"
                android:textColor="#ffffff"
                android:layout_weight="1"
                android:textSize="20dp"
                >

            </TextView>

        </LinearLayout>
    </LinearLayout>
    <LinearLayout
        android:layout_below="@id/li"
        android:layout_width="300dp"
        android:layout_centerInParent="true"
        android:orientation="horizontal"
        android:layout_height="40dp">
        <Button
            android:layout_weight="1"
            android:layout_width="0dp"
            android:layout_height="wrap_content"
            android:text="备用"
            android:background="#05DEDF"></Button>
        <Button
            android:layout_weight="1"
            android:layout_width="0dp"
            android:layout_height="wrap_content"
            android:text="备用"
            android:background="#05DEDF"></Button>
        <Button
            android:layout_weight="1"
            android:layout_width="0dp"
            android:layout_height="wrap_content"
            android:text="备用"
            android:background="#05DEDF"></Button>
        <Button
            android:layout_weight="1"
            android:layout_width="0dp"
            android:layout_height="wrap_content"
            android:text="备用"
            android:background="#05DEDF"></Button>
        <Button
            android:layout_weight="1"
            android:layout_width="0dp"
            android:layout_height="wrap_content"
            android:text="备用"
            android:background="#05DEDF"></Button>

    </LinearLayout>

</RelativeLayout>
  • 0
    点赞
  • 7
    收藏
    觉得还不错? 一键收藏
  • 打赏
    打赏
  • 0
    评论
智能家居 app 源码是指用于开发智能家居应用程序的代码智能家居 app 是一种基于移动设备的应用程序,通过连接智能设备,实现对家居设备进行远程控制、监控和管理的功能。 智能家居 app 源码一般包含以下几个方面: 1. 用户界面设计:包括应用程序的整体布局、界面风格和交互效果的设计。通常使用 XML 文件定义应用程序的界面,如布局、按钮、列表等。 2. 后台逻辑处理:包括与智能设备进行通信的接口设计、数据传输和处理的逻辑编写。可以使用各种协议和技术,如 Wi-Fi、蓝牙、ZigBee 等来实现设备之间的通信。 3. 数据库设计:用于存储用户信息、设备数据等重要信息的数据库设计和操作。可以使用 SQLite 或其他数据库技术进行数据存储和管理。 4. 安全性处理:涉及用户隐私保护和数据安全的处理。包括用户身份认证、数据加密、权限控制等功能的实现。 5. 远程推送和通知:用于远程控制、设备状态变化通知等功能的推送和通知机制。 6. 第三方服务集成:如调用地图服务、天气服务等,以提供更多功能。 7. 应用程序测试和调试:包括代码调试、界面测试和用户体验测试等。 8. 必要的文档和说明:为开发和使用者提供清晰明确的文档和说明,包括安装、部署和使用方法等。 智能家居 app 源码的开发需要熟悉移动应用开发技术和智能设备通信技术。常用的开发语言有 Java、Swift等。开发者可以基于现有的智能家居平台进行二次开发,也可以从零开始自己设计和开发。通过使用智能家居 app 源码,可以快速开发出高质量的智能家居应用程序,提供便捷、智能化的家居体验。

“相关推荐”对你有帮助么?

  • 非常没帮助
  • 没帮助
  • 一般
  • 有帮助
  • 非常有帮助
提交
评论
添加红包

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

当前余额3.43前往充值 >
需支付:10.00
成就一亿技术人!
领取后你会自动成为博主和红包主的粉丝 规则
hope_wisdom
发出的红包

打赏作者

陈学弟

你的鼓励将是我创作的最大动力

¥1 ¥2 ¥4 ¥6 ¥10 ¥20
扫码支付:¥1
获取中
扫码支付

您的余额不足,请更换扫码支付或充值

打赏作者

实付
使用余额支付
点击重新获取
扫码支付
钱包余额 0

抵扣说明:

1.余额是钱包充值的虚拟货币,按照1:1的比例进行支付金额的抵扣。
2.余额无法直接购买下载,可以购买VIP、付费专栏及课程。

余额充值