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