Android小项目——多人聊天室

Android小项目——多人聊天室

前言

在学习完了java的IO流,多线程,网络编程后,编写了一个简单的聊天室,但是很多功能还没有实现。如:注册功能未实现,因为不清楚怎么将账号密码信息存储到远程,学习了Android的数据存储方案(文件存储,SharedPreferences存储和数据库存储),但是发现这个存储只是本地的存储,因此登录和注册部分还存在问题,登录账号和密码都设置为admin;可以实现记住密码功能

正文

聊天室分为客户端和服务器端,服务器端完全由java代码实现,客户端由Android实现。
客户端首先是一个登录界面,若登录成功则进入聊天界面。
以下是登录界面布局文件代码,该布局最外层为一个垂直线性布局,内层嵌套四个水平线性布局

<?xml version="1.0" encoding="utf-8"?>
<LinearLayout
    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:orientation="vertical"
    tools:context=".MainActivity">

    <LinearLayout
        android:id="@+id/linearLayout"
        android:layout_width="282dp"
        android:layout_height="wrap_content"
        android:layout_marginTop="150dp"
        android:orientation="horizontal">

        <TextView
            android:layout_width="wrap_content"
            android:layout_height="wrap_content"
            android:layout_marginRight="30dp"
            android:layout_marginLeft="52dp"
            android:text="账号"
            android:textSize="20dp" />

        <EditText
            android:id="@+id/account_text"
            android:layout_width="wrap_content"
            android:layout_height="wrap_content"
            android:background="@null"
            android:hint="输入用户名" />
    </LinearLayout>

    <LinearLayout
        android:id="@+id/linearLayout3"
        android:layout_width="282dp"
        android:layout_height="wrap_content"
        android:layout_marginTop="20dp"
        android:orientation="horizontal">

        <TextView
            android:layout_width="wrap_content"
            android:layout_height="wrap_content"
            android:layout_marginRight="30dp"
            android:layout_marginLeft="52dp"
            android:text="密码"
            android:textSize="20dp" />

        <EditText
            android:id="@+id/password_text"
            android:layout_width="wrap_content"
            android:layout_height="wrap_content"
            android:background="@null"
            android:hint="输入密码" />
    </LinearLayout>

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

        <CheckBox
            android:id="@+id/remember_password"
            android:layout_width="wrap_content"
            android:layout_height="wrap_content"
            android:layout_marginLeft="100dp"/>

        <
  • 10
    点赞
  • 46
    收藏
    觉得还不错? 一键收藏
  • 4
    评论
评论 4
添加红包

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

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

抵扣说明:

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

余额充值