Android:安卓开发采用Volley网络框架+MySQL数据库,实现从服务器获取数据并展示完成记单词APP

一、功能与要求

实现功能:设计一个记单词APP。服务器采用Tomcat,数据库采用Mysql。实现用户的注册登录功能以及单词的增删改查。

指标要求:实现UI布局;将系统数据保存到Mysql数据库中,并采用Volley网络框架实现从服务器获取数据并展示。

二 项目实现步骤

步骤1:搭建开发环境。
步骤2:准备资源。
步骤3:UI设计与开发。
步骤4:实现服务器端。
步骤5:实现客户端后台:包括用户的登陆注册及单词的增删改查功能。

三、项目实现

(一)服务器端代码
服务器端核心代码如下:
1.配置数据库代码:
server:
port: 8080

spring:
application:
# 应用的名称,可选
name: reggie_take_out
datasource:
druid:
driver-class-name: com.mysql.cj.jdbc.Driver
url: jdbc:mysql://localhost:3306/readword
username: root
password: 0925
main:
banner-mode: off
mybatis-plus:
configuration:
#在映射实体或者属性时,将数据库中表名和字段名中的下划线去掉,按照驼峰命名法映射
map-underscore-to-camel-case: true
log-impl: org.apache.ibatis.logging.stdout.StdOutImpl
global-config:
db-config:
id-type: ASSIGN_ID
登录界面UI代码:

<?xml version="1.0" encoding="utf-8"?>

<LinearLayout
    android:layout_width="match_parent"
    android:layout_height="wrap_content"
    android:layout_marginLeft="50dp"
    android:layout_marginTop="440dp"
    android:layout_marginRight="50dp"
    android:orientation="horizontal">

    <TextView
        android:id="@+id/textView"
        android:layout_width="wrap_content"
        android:layout_height="wrap_content"
        android:layout_weight="1"
        android:gravity="right"
        android:text="用户名称:"
        android:textSize="22sp" />

    <EditText
        android:id="@+id/editTextTextPersonName"
        android:layout_width="wrap_content"
        android:layout_height="wrap_content"
        android:layout_weight="1"
        android:textSize="22sp"
        android:hint="请输入用户名"
        android:inputType="textPersonName" />
</LinearLayout>

<LinearLayout
    android:layout_width="match_parent"
    android:layout_height="wrap_content"
    android:layout_marginLeft="50dp"
    android:layout_marginRight="50dp"
    android:orientation="horizontal">

    <TextView
        android:id="@+id/textView2"
        android:layout_width="wrap_content"
        android:layout_height="wrap_content"
        android:layout_weight="1"
        android:gravity="right"
        android:text="用户密码:"
        android:textSize="22sp" />

    <EditText
        android:id="@+id/editTextTextPassword"
        android:layout_width="wrap_content"
        android:layout_height="wrap_content"
        android:layout_weight="1"
        android:maxLines="1"
        android:textSize="22sp"
        android:inputType="textPassword"
        android:hint="输入六位密码" />
</LinearLayout>

<LinearLayout
    android:layout_width="match_parent"
    android:layout_height="35dp"
    android:layout_marginLeft="50dp"
    android:layout_marginRight="50dp"
    android:orientation="horizontal">

    <Button
        android:id="@+id/button5"
        android:layout_width="wrap_content"
        android:layout_height="wrap_content"
        android:layout_weight="1"
        android:layout_marginTop="10dp"
        android:gravity="right"
        android:background="#00FFFFFF"
        android:text="忘记密码?"
        android:onClick="onClick"
        android:textColor="#6B6868"
        android:textSize="18sp" />

</LinearLayout>

<LinearLayout
    android:layout_width="match_parent"
    android:layout_height="wrap_content"
    android:layout_marginLeft="50dp"
    android:layout_marginRight="50dp"
    android:orientation="horizontal">

    <Button
        android:id="@+id/button2"
        android:layout_width="wrap_content"
        android:layout_height="wrap_content"
        android:layout_weight="1"
        android:text="登录"
        android:onClick="onClick"
        android:textSize="20sp" />

    <Button
        android:id="@+id/button3"
        android:layout_width="wrap_content"
        android:layout_height="wrap_content"
        android:layout_weight="1"
        android:onClick="onClick"
        android:text="注册"
        android:textSize="20sp" />

    <Button
        android:id="@+id/button4"
        android:layout_width="wrap_content"
        android:layout_height="wrap_content"
        android:layout_weight="1"
        android:text="查询"
        android:onClick="onClick"
        android:textSize="20sp" />
</LinearLayout>

四 效果展示

在这里插入图片描述
在这里插入图片描述
在这里插入图片描述
在这里插入图片描述
在这里插入图片描述
在这里插入图片描述
在这里插入图片描述
在这里插入图片描述

数据库表及数据展示

User表:
在这里插入图片描述

在这里插入图片描述

Word表
在这里插入图片描述
在这里插入图片描述

五 总结与收获

通过该项目的设计,掌握Android项目设计开发流程,学会了使用网络框架完成了一款记单词软件,UI布局界面使用了很多控件,使我掌握了TextView、EditText、Button、ratingBar、RadioGroup、radioButton、toggleButton、checkBox、spinner等控件的使用、后台使用了AlertDialog实现了注册按钮弹出对话框。此次项目设计不仅仅使对我技术上的锻炼有所提高,更多的是为我之后的学习奠定了良好的基础,但是依然有很多的不足之处需要我们继续完善和改正。
系统还有很多可以改进的地方,还可以对代码进行进一步改进和优化。在页面上,还不够美观,对于UI设计还有很多需要进一步提升的地方。很多问题都需要我在今后不断学习来解决和完善。
在整个系统的需求分析过程中对开发前期工作地流程步骤有了深入的掌握;在开发过程我进一步学习了Java的基础语法,和一些xml设计美工方面的知识,以便使系统有更好的美观性,在编写过程中也规范了许多编码习惯,数据库设计阶段我学习了Mysql数据库,在一些基本操作上也有了进一步提高。在配置开发工具过程中对Tomcat和IDEA的连接部署有了清晰地认识,在使用第三方插件json进行了其配置也有了相当的了解, 对开发程序的步骤框架有了总体性认识。
在整个系统开发的过程中,我学到了很多新的知识,之前学过的许多知识点在运用过程中也有了更为深入的分析,在这个过程中也体会到了如何将书本知识转化到实际的应用中。
通过本项目的开发,我深入了解了安卓开发、网络请求框架、后台开发和数据库等技术,并且掌握了这些技术的应用方法。在项目开发过程中,我遇到了许多问题,但通过不断地学习和实践,我成功地解决了这些问题,并且取得了不错的成果。通过本项目的开发,我不仅提高了自己的技术水平,也增强了自己的实践能力和团队协作能力。最后,也感谢老师和同学们对我的帮助,我相信这对我今后的工作有很大的帮助。
在今后,我们也将不断学习来提升我们的编码能力和系统分析设计能力,使自己能力得到提高。

猜你喜欢

转载自blog.csdn.net/weixin_48622654/article/details/131620100