WIFI小车之旅(二)手机控制端

<span style="font-family: Arial, Helvetica, sans-serif; background-color: rgb(255, 255, 255);">手机端的上机位比较的简单…共两个界面…一个界面用于设置IP和用户名和密码…另一个是主要的控制界面…用于给路由器传递控制指令并接受从路由器传递回来的数据显示在手机屏幕上…界面如下……</span>



登录界面比较的简单,就四个编辑框和两个按钮,一个登录一个退出,通信方面使用的是较为简单的socket,源代码如下:


<RelativeLayout xmlns:android="http://schemas.android.com/apk/res/android"
    xmlns:tools="http://schemas.android.com/tools"
    android:layout_width="match_parent"
    android:layout_height="match_parent"
    android:background="#fff6f6f6" >

    <LinearLayout
        android:id="@+id/input_mainxml"
        android:layout_width="wrap_content"
        android:layout_height="wrap_content"
        android:layout_centerInParent="true"
        android:orientation="vertical" >

        <LinearLayout
            android:layout_width="wrap_content"
            android:layout_height="wrap_content"
            android:orientation="horizontal" >

            <TextView
                android:layout_width="70dp"
                android:layout_height="match_parent"
                android:gravity="center_vertical"
                android:text="IP:"
                android:textSize="25sp" />

            <LinearLayout
                android:layout_width="wrap_content"
                android:layout_height="wrap_content"
                android:background="@drawable/background_style_black" >

                <EditText
                    android:id="@+id/edi_input_ip"
                    android:layout_width="220dp"
                    android:layout_height="wrap_content"
                    android:layout_margin="1dp"
                    android:background="@drawable/background_style_white"
                    android:maxLength="15"
                    android:textSize="25sp" />
            </LinearLayout>
        </LinearLayout>

        <LinearLayout
            android:layout_width="wrap_content"
            android:layout_height="wrap_content"
            android:layout_marginTop="5dp"
            android:orientation="horizontal" >

            <TextView
                android:layout_width="70dp"
                android:layout_height="match_parent"
                android:gravity="center_vertical"
                android:text="端口:"
                android:textSize="18sp" />

            <LinearLayout
                android:layout_width="wrap_content"
                android:layout_height="wrap_content"
                android:background="@drawable/background_style_black" >

                <EditText
                    android:id="@+id/edi_input_port"
                    android:layout_width="220dp"
                    android:layout_height="wrap_content"
                    android:layout_margin="1dp"
                    android:background="@drawable/background_style_white"
                    android:inputType="number"
                    android:maxLength="5"
                    android:textSize="25sp" />
            </LinearLayout>
        </LinearLayout>

        <LinearLayout
            android:layout_width="wrap_content"
            android:layout_height="wrap_content"
            android:layout_marginTop="5dp"
            android:orientation="horizontal" >

            <TextView
                android:layout_width="70dp"
                android:layout_height="match_parent"
                android:gravity="center_vertical"
                android:text="用户:"
                android:textSize="18sp" />

            <LinearLayout
                android:layout_width="wrap_content"
                android:layout_height="wrap_content"
                android:background="@drawable/background_style_black" >

                <EditText
                    android:id="@+id/edi_input_user"
                    android:layout_width="220dp"
                    android:layout_height="wrap_content"
                    android:layout_margin="1dp"
                    android:background="@drawable/background_style_white"
                    android:maxLength="20"
                    android:textSize="25sp" />
            </LinearLayout>
        </LinearLayout>

        <LinearLayout
            android:layout_width="wrap_content"
            android:layout_height="wrap_content"
            android:layout_marginTop="5dp"
            android:orientation="horizontal" >

            <TextView
                android:layout_width="70dp"
                android:layout_height="match_parent"
                android:gravity="center_vertical"
                android:text="密码:"
                android:textSize="18sp" />

            <LinearLayout
                android:layout_width="wrap_content"
                android:layout_height="wrap_content"
                android:background="@drawable/background_style_black" >

                <EditText
                    android:id="@+id/edi_input_password"
                    android:layout_width="220dp"
                    android:layout_height="wrap_content"
                    android:layout_margin="1dp"
                    android:background="@drawable/background_style_white"
                    android:inputType="textPassword"
                    android:maxLength="20"
                    android:textSize="25sp" />
            </LinearLayout>
        </LinearLayout>
    </LinearLayout>

    <LinearLayout
        android:layout_width="wrap_content"
        android:layout_height="wrap_content"
        android:layout_below="@id/input_mainxml"
        android:layout_centerHorizontal="true"
        android:layout_marginTop="10dp"
        android:orientation="horizontal" >

        <LinearLayout
            android:layout_width="wrap_content"
            android:layout_height="wrap_content"
            android:background="@drawable/background_style_black" >

            <Button
                android:id="@+id/bnt_login"
                android:layout_width="120dp"
                android:layout_height="35dp"
                android:layout_margin="1dp"
                android:background="@drawable/background_style_green"
                android:text="登录"
                android:textSize="25sp" />
        </LinearLayout>

        <LinearLayout
            android:layout_width="wrap_content"
            android:layout_height="wrap_content"
            android:
  • 3
    点赞
  • 26
    收藏
    觉得还不错? 一键收藏
  • 3
    评论

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

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

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

当前余额3.43前往充值 >
需支付:10.00
成就一亿技术人!
领取后你会自动成为博主和红包主的粉丝 规则
hope_wisdom
发出的红包
实付
使用余额支付
点击重新获取
扫码支付
钱包余额 0

抵扣说明:

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

余额充值