在学习了郭神的第一行代码前半段之后,想通过一次实践来完成对已学知识的巩固。于是码下了这个图书管理系统客户端。
IDE Android studio,语言 JAVA、XML;
在刚开始设计的时候对于这个程序的设定是:
1.支持学生、教师、工作人员三种不同身份的客户。
2.学生、老师各自注册账号,并用账号登录。
3.学生、老师能够查询、借阅、归还图书,逾期没有归还图书的客户将被列入黑名单。
4.含有图书馆的介绍与新闻通知板块。
5.管理人员能够添加书籍。
6.含有新书上架和借阅排行榜两个list。
7.所有信息从服务器上访问得到,支持不同客户端共享相同数据
在经过了一段时间的磨蹭之后,终于将图书管理系统基本完成:
但和最开始的设定有了一些偏差:由于教师和学生的不同之处仅仅是借阅书籍的最大数量不同,因此将教师这一身份舍去。在写客户端向服务器(Windows下建了一个微型服务器)通信的时候遇到了很大的困难,长时间的码代码、编译、通过、服务器无反应之后,暂时放弃了连接服务器这一功能,将所有用户与书籍的数据储存在了Android系统自带的数据库中。这样使得过程难度降低了很多,但是无法实现不同客户端访问的数据统一化,也就是从联网退化至了单机。
但是学习仍在路上,以后有时间当将这些不足得以改善。
下面来讲解图书管理系统的制作过程。
主页面:
![](https://i-blog.csdnimg.cn/blog_migrate/d9c5c41f5cd4d29fdbe8456ab5891654.jpeg)
![](https://i-blog.csdnimg.cn/blog_migrate/68f724bad5a33d9a9f6bd2ca7369ecb7.gif)
新手上路,界面很low》》》》》》
![](https://i-blog.csdnimg.cn/blog_migrate/8f900a89c6347c561fdf2122f13be562.gif)
![](https://i-blog.csdnimg.cn/blog_migrate/961ddebeb323a10fe0623af514929fc1.gif)
1 <?xml version="1.0" encoding="utf-8"?> 2 <LinearLayout xmlns:android="http://schemas.android.com/apk/res/android" 3 xmlns:app="http://schemas.android.com/apk/res-auto" 4 xmlns:tools="http://schemas.android.com/tools" 5 android:layout_width="match_parent" 6 android:layout_height="match_parent" 7 android:gravity="center" 8 android:orientation="vertical" 9 tools:context=".MainActivity"> 10 11 <ImageView 12 android:id="@+id/image_view_id" 13 android:layout_width="match_parent" 14 android:layout_height="0dp" 15 android:layout_weight="6" 16 android:src="@drawable/img_1" /> 17 18 <TextView 19 android:layout_width="match_parent" 20 android:layout_height="0dp" 21 android:gravity="center" 22 android:textSize="30sp" 23 android:layout_weight="2" 24 android:text="欢迎使用图书馆安卓客户端" /> 25 26 <LinearLayout 27 android:layout_width="match_parent" 28 android:layout_height="0dp" 29 android:layout_weight="4" 30 android:orientation="horizontal"> 31 32 <Button 33 android:id="@+id/introduce_id" 34 android:layout_width="0dp" 35 android:layout_height="match_parent" 36 android:layout_weight="1" 37 android:textSize="21sp" 38 android:text="图书馆介绍" /> 39 40