• 博客园logo
  • 会员
  • 众包
  • 新闻
  • 博问
  • 闪存
  • 赞助商
  • HarmonyOS
  • Chat2DB
    • 搜索
      所有博客
    • 搜索
      当前博客
  • 写随笔 我的博客 短消息 简洁模式
    用户头像
    我的博客 我的园子 账号设置 会员中心 简洁模式 ... 退出登录
    注册 登录
MKT-porter
博客园    首页    新随笔    联系   管理    订阅  订阅
界面设计参考(1)tcp服务器

 https://github.com/perihanmirkelam/TcpServer

 

 

 

 

 

<?xml version="1.0" encoding="utf-8"?>
<android.support.constraint.ConstraintLayout 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"
    tools:context="com.example.a99.myapplication.MainActivity">


    <LinearLayout xmlns:android="http://schemas.android.com/apk/res/android"
        android:layout_width="368dp"
        android:layout_height="495dp"
        android:orientation="vertical"
        android:weightSum="5"
        tools:layout_editor_absoluteY="8dp"
        tools:layout_editor_absoluteX="8dp">

        <LinearLayout
            android:layout_width="match_parent"
            android:layout_height="0dp"
            android:orientation="vertical"
            android:layout_weight="1">
            <LinearLayout
                android:layout_width="match_parent"
                android:layout_height="0dp"
                android:layout_weight="1"
                android:orientation="horizontal">
                <TextView
                    android:layout_width="wrap_content"
                    android:layout_height="wrap_content"
                    android:text="本机ip:"/>
                <TextView
                    android:layout_width="0dp"
                    android:layout_weight="2"
                    android:layout_height="match_parent"
                    android:gravity="center"
                    android:id="@+id/txt_Server_Ip"/>
                <TextView
                    android:layout_width="wrap_content"
                    android:layout_height="wrap_content"
                    android:text="port"/>

                <EditText
                    android:id="@+id/edit_Server_Port"
                    android:layout_width="0dp"
                    android:layout_height="match_parent"
                    android:layout_weight="1"
                    android:hint="1234"
                    android:inputType="number" />
            </LinearLayout>
            <LinearLayout
                android:layout_width="match_parent"
                android:layout_height="0dp"
                android:orientation="horizontal"
                android:layout_weight="1">
                <TextView
                    android:layout_width="wrap_content"
                    android:layout_height="wrap_content"
                    android:text="ID(英文或数字):"/>
                <EditText
                    android:layout_width="0dp"
                    android:layout_weight="1"
                    android:layout_height="match_parent"
                    android:id="@+id/edit_Server_ID"/>
                <Button
                    android:layout_width="wrap_content"
                    android:layout_height="match_parent"
                    android:text="随机生成"
                    android:id="@+id/btn_tcpServerRandomID"/>
            </LinearLayout>

        </LinearLayout>
        <LinearLayout
            android:layout_width="match_parent"
            android:layout_height="wrap_content"
            >
            <Button
                android:layout_width="wrap_content"
                android:layout_height="wrap_content"
                android:text="开启"
                android:id="@+id/btn_tcpServerConn"/>
            <Button
                android:layout_width="wrap_content"
                android:layout_height="wrap_content"
                android:text="关闭"
                android:id="@+id/btn_tcpServerClose"/>
            <Button
                android:layout_width="wrap_content"
                android:layout_height="wrap_content"
                android:text="清除接收区"
                android:id="@+id/btn_tcpCleanServerRecv"/>
            <Button
                android:layout_width="wrap_content"
                android:layout_height="wrap_content"
                android:text="清除发送区"
                android:id="@+id/btn_tcpCleanServerSend"/>
        </LinearLayout>
        <LinearLayout
            android:layout_width="match_parent"
            android:layout_height="0dp"
            android:orientation="vertical"
            android:layout_weight="2">
            <TextView
                android:layout_width="match_parent"
                android:layout_height="0dp"
                android:layout_weight="1"
                android:gravity="bottom"
                android:text="接收区:" />
            <TextView
                android:layout_width="match_parent"
                android:layout_weight="5"
                android:layout_height="0dp"
                android:id="@+id/txt_ServerRcv"
                android:background="@android:color/holo_blue_light"
                />

        </LinearLayout>

        <LinearLayout
            android:layout_width="match_parent"
            android:layout_height="0dp"
            android:orientation="vertical"
            android:layout_weight="2">
            <TextView
                android:layout_width="wrap_content"
                android:layout_height="0dp"
                android:layout_weight="1"
                android:text="发送区:" />

            <TextView
                android:id="@+id/txt_ServerSend"
                android:layout_width="match_parent"
                android:layout_height="0dp"
                android:layout_weight="7"
                android:background="@android:color/holo_purple" />

            <LinearLayout
                android:layout_width="match_parent"
                android:layout_height="0dp"
                android:orientation="horizontal"
                android:layout_weight="2">
                <EditText
                    android:layout_width="0dp"
                    android:layout_weight="5"
                    android:id="@+id/edit_Send"
                    android:layout_height="match_parent" />
                <Button
                    android:layout_width="0dp"
                    android:layout_weight="1"
                    android:layout_height="match_parent"
                    android:layout_gravity="right"
                    android:id="@+id/btn_tcpServerSend"
                    android:text="发送"/>
            </LinearLayout>
        </LinearLayout>
    </LinearLayout>
<?xml version="1.0" encoding="utf-8"?>
<android.support.constraint.ConstraintLayout 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"
    tools:context="com.example.a99.myapplication.MainActivity">


    <LinearLayout xmlns:android="http://schemas.android.com/apk/res/android"
        android:layout_width="368dp"
        android:layout_height="495dp"
        android:orientation="vertical"
        android:weightSum="5"
        tools:layout_editor_absoluteY="8dp"
        tools:layout_editor_absoluteX="8dp">

        <LinearLayout
            android:layout_width="match_parent"
            android:layout_height="0dp"
            android:orientation="vertical"
            android:layout_weight="1">
            <LinearLayout
                android:layout_width="match_parent"
                android:layout_height="0dp"
                android:layout_weight="1"
                android:orientation="horizontal">
                <TextView
                    android:layout_width="wrap_content"
                    android:layout_height="wrap_content"
                    android:text="本机ip:"/>
                <TextView
                    android:layout_width="0dp"
                    android:layout_weight="2"
                    android:layout_height="match_parent"
                    android:gravity="center"
                    android:id="@+id/txt_Server_Ip"/>
                <TextView
                    android:layout_width="wrap_content"
                    android:layout_height="wrap_content"
                    android:text="port"/>

                <EditText
                    android:id="@+id/edit_Server_Port"
                    android:layout_width="0dp"
                    android:layout_height="match_parent"
                    android:layout_weight="1"
                    android:hint="1234"
                    android:inputType="number" />
            </LinearLayout>
            <LinearLayout
                android:layout_width="match_parent"
                android:layout_height="0dp"
                android:orientation="horizontal"
                android:layout_weight="1">
                <TextView
                    android:layout_width="wrap_content"
                    android:layout_height="wrap_content"
                    android:text="ID(英文或数字):"/>
                <EditText
                    android:layout_width="0dp"
                    android:layout_weight="1"
                    android:layout_height="match_parent"
                    android:id="@+id/edit_Server_ID"/>
                <Button
                    android:layout_width="wrap_content"
                    android:layout_height="match_parent"
                    android:text="随机生成"
                    android:id="@+id/btn_tcpServerRandomID"/>
            </LinearLayout>

        </LinearLayout>
        <LinearLayout
            android:layout_width="match_parent"
            android:layout_height="wrap_content"
            >
            <Button
                android:layout_width="wrap_content"
                android:layout_height="wrap_content"
                android:text="开启"
                android:id="@+id/btn_tcpServerConn"/>
            <Button
                android:layout_width="wrap_content"
                android:layout_height="wrap_content"
                android:text="关闭"
                android:id="@+id/btn_tcpServerClose"/>
            <Button
                android:layout_width="wrap_content"
                android:layout_height="wrap_content"
                android:text="清除接收区"
                android:id="@+id/btn_tcpCleanServerRecv"/>
            <Button
                android:layout_width="wrap_content"
                android:layout_height="wrap_content"
                android:text="清除发送区"
                android:id="@+id/btn_tcpCleanServerSend"/>
        </LinearLayout>
        <LinearLayout
            android:layout_width="match_parent"
            android:layout_height="0dp"
            android:orientation="vertical"
            android:layout_weight="2">
            <TextView
                android:layout_width="match_parent"
                android:layout_height="0dp"
                android:layout_weight="1"
                android:gravity="bottom"
                android:text="接收区:" />
            <TextView
                android:layout_width="match_parent"
                android:layout_weight="5"
                android:layout_height="0dp"
                android:id="@+id/txt_ServerRcv"
                android:background="@android:color/holo_blue_light"
                />

        </LinearLayout>

        <LinearLayout
            android:layout_width="match_parent"
            android:layout_height="0dp"
            android:orientation="vertical"
            android:layout_weight="2">
            <TextView
                android:layout_width="wrap_content"
                android:layout_height="0dp"
                android:layout_weight="1"
                android:text="发送区:" />

            <TextView
                android:id="@+id/txt_ServerSend"
                android:layout_width="match_parent"
                android:layout_height="0dp"
                android:layout_weight="7"
                android:background="@android:color/holo_purple" />

            <LinearLayout
                android:layout_width="match_parent"
                android:layout_height="0dp"
                android:orientation="horizontal"
                android:layout_weight="2">
                <EditText
                    android:layout_width="0dp"
                    android:layout_weight="5"
                    android:id="@+id/edit_Send"
                    android:layout_height="match_parent" />
                <Button
                    android:layout_width="0dp"
                    android:layout_weight="1"
                    android:layout_height="match_parent"
                    android:layout_gravity="right"
                    android:id="@+id/btn_tcpServerSend"
                    android:text="发送"/>
            </LinearLayout>
        </LinearLayout>
    </LinearLayout>




</android.support.constraint.ConstraintLayout>




</android.support.constraint.ConstraintLayout>

  

posted on 2021-05-14 23:04  MKT-porter  阅读(81)  评论(0)    收藏  举报
刷新页面返回顶部
博客园  ©  2004-2025
浙公网安备 33010602011771号 浙ICP备2021040463号-3