目录
一、项目简介
使用软件
Android Studio 4.0.0(2020版)
使用语言
JAVA
数据库
SQLite
注释量
中文注释量90%以上
项目页面
启动页、登录页、注册页、首页、添加修改页
关键技术点
SQLite数据库、本地存,通过SQLiteOpenHelper管理表结构及增删改查操作。采用MVP模式解耦界面与逻辑View层处理UI交互,Presenter层协调数据与视图,Model层封装数据库操作
二、演示视频
安卓原创--基于Android studio 菜单管理系统
三、项目要求
1.APP启动后,进人闪屏界面,2秒后,如用户曾登录(未退出)则直接跳转到主界面;否则跳转到用户登录界面。
2.实现新用户注册功能
3.实现用户退出登录功能
4.在主界面能对菜单实现增加、删除修改、查询等功能;
5.提高分:执行添加或者修改功能时启动另一个界面实现菜单的添加或者修改功能;
6.菜单信息字段不少于4个、记录不少于10条;
7.进阶分:能记录多个曾登录过的用户名。
设计参数:
1.采用本地 SQLite 数据库保存用户名和菜单信息;
2.采用MVP的设计模式;
3.界面简洁、美观大方;具有友好的人机交互功能;
4.使用适配器+ListView/ScrollView组件展示菜单信息;
5.报告内容阐述全面、逻辑结构安排合理、格式规范。
四、设计详情(部分)
登录页

1.页面的结构
该登录页面采用经典的用户认证界面布局,顶部显示应用名称,中部为输入区域包含用户名和密码两个文本输入框,采用Material Design风格的EditText组件实现。
底部区域采用水平线性布局,并列放置登录和注册两个按钮,整体布局简洁清晰,符合Android设计规范。
2.使用到的技术
该页面基于Android Studio开发环境,采用Java语言编写核心逻辑,使用AppCompat兼容库确保界面一致性。通过UserManager单例类实现用户状态管理,采用Toast组件提供用户操作反馈。
使用Intent实现页面跳转功能,通过findViewById方法完成视图绑定,整体采用MVC架构模式分离业务逻辑与界面展示。
3.页面详细介绍
该页面主要实现用户登录功能,提供用户名密码输入验证机制。用户输入凭证后系统会校验非空规则,并通过用户管理器验证账户有效性。
登录成功自动跳转至主界面并销毁当前页面,失败则显示错误提示。注册按钮可引导新用户前往注册页面,所有交互均配有即时文字提示,确保用户体验流畅性。
XML
<?xml version="1.0" encoding="utf-8"?>
<LinearLayout 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"
android:orientation="vertical"
android:padding="20dp"
android:background="@color/background"
android:gravity="center">
<ImageView
android:id="@+id/imageView"
android:layout_width="match_parent"
android:layout_height="200dp"
android:layout_marginBottom="40dp"
app:srcCompat="@drawable/logo" />
<LinearLayout
android:layout_width="match_parent"
android:layout_height="wrap_content"
android:orientation="vertical"
android:background="@color/white"
android:padding="20dp"
android:elevation="4dp">
<EditText
android:id="@+id/etUsername"
android:layout_width="match_parent"
android:layout_height="wrap_content"
android:layout_marginBottom="16dp"
android:hint="@string/hint_username"
android:inputType="text"
android:maxLines="1"
android:textColor="@color/text_dark"
android:textColorHint="@color/text_light"
tools:hint="请输入用户名" />
<EditText
android:id="@+id/etPassword"
android:layout_width="match_parent"
android:layout_height="wrap_content"
android:layout_marginBottom="24dp"
android:hint="@string/hint_password"
android:inputType="textPassword"
android:maxLines="1"
android:textColor="@color/text_dark"
android:textColorHint="@color/text_light"
tools:hint="请输入用户密码" />
<Button
android:id="@+id/btnLogin"
android:layout_width="match_parent"
android:layout_height="wrap_content"
android:text="@string/btn_login"
android:textColor="@color/white"
android:background="@color/colorPrimary"
android:layout_marginBottom="16dp" />
<Button
android:id="@+id/btnRegister"
android:layout_width="match_parent"
android:layout_height="wrap_content"
android:text="@string/btn_register"
android:textColor="@color/colorPrimary"
android:background="@android:color/transparent"
android:drawableTop="@null" />
</LinearLayout>
</LinearLayout>
首页

1.页面的结构
该主界面采用经典的列表展示布局,顶部为搜索区域包含输入框和搜索按钮,右侧配有添加功能的浮动按钮。
中部核心区域为ListView列表视图,用于展示所有菜单项的详细信息。底部设有退出登录按钮,整体布局层次清晰,功能分区明确,符合用户操作习惯。
2.使用到的技术
该页面运用Android的ListView组件配合自定义Adapter实现数据展示,通过DatabaseHelper类进行SQLite数据库操作。
采用AlertDialog构建删除确认对话框,使用Intent进行页面间数据传递。
利用ActivityResult机制处理页面回调,通过Collections工具实现数据排序,整体采用观察者模式更新数据变化。
3.页面详细介绍
该页面作为系统核心界面,提供菜单的全面管理功能。用户可通过搜索框快速筛选菜品,点击添加按钮进入创建页面。
每个菜单项支持编辑和删除操作,删除前会弹出二次确认对话框防止误操作。
界面实时同步数据库变化,退出登录功能会清空用户状态并返回登录页,确保系统安全性。
XML
<?xml version="1.0" encoding="utf-8"?>
<androidx.constraintlayout.widget.ConstraintLayout xmlns:android="http://schemas.android.com/apk/res/android"
xmlns:app="http://schemas.android.com/apk/res-auto"
android:layout_width="match_parent"
android:layout_height="match_parent"
android:background="@color/background">
<LinearLayout
android:id="@+id/linearLayout2"
android:layout_width="match_parent"
android:layout_height="60dp"
android:background="@color/colorPrimary"
android:orientation="horizontal"
app:layout_constraintEnd_toEndOf="parent"
app:layout_constraintStart_toStartOf="parent"
app:layout_constraintTop_toTopOf="parent">
<TextView
android:layout_width="0dp"
android:layout_height="match_parent"
android:layout_marginLeft="10dp"
android:layout_weight="1"
android:gravity="center|left"
android:text="@string/main_title"
android:textColor="@color/white"
android:textSize="18sp"
android:textStyle="bold" />
<Button
android:id="@+id/btnLogout"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:background="@android:color/transparent"
android:text="@string/action_logout"
android:textColor="@color/white" />
</LinearLayout>
<LinearLayout
android:id="@+id/linearLayout"
android:layout_width="match_parent"
android:layout_height="60dp"
android:background="@color/white"
android:gravity="center"
android:orientation="horizontal"
app:layout_constraintEnd_toEndOf="parent"
app:layout_constraintStart_toStartOf="parent"
app:layout_constraintTop_toBottomOf="@+id/linearLayout2">
<EditText
android:id="@+id/etSearch"
android:layout_width="match_parent"
android:layout_height="wrap_content"
android:layout_marginLeft="10dp"
android:layout_weight="1"
android:hint="@string/search_hint"
android:inputType="text"
android:maxLines="1"
android:textColor="@color/text_dark"
android:textColorHint="@color/text_light" />
<Button
android:id="@+id/btnSearch"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:layout_marginLeft="10dp"
android:layout_marginRight="10dp"
android:background="@color/colorPrimary"
android:text="@string/action_search"
android:textColor="@color/white" />
</LinearLayout>
<ListView
android:id="@+id/lvMenu"
android:layout_width="0dp"
android:layout_height="0dp"
android:divider="@color/light_gray"
android:dividerHeight="1dp"
app:layout_constraintBottom_toBottomOf="parent"
app:layout_constraintEnd_toEndOf="parent"
app:layout_constraintStart_toStartOf="parent"
app:layout_constraintTop_toBottomOf="@+id/linearLayout" />
<ImageView
android:id="@+id/img_add"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:layout_marginEnd="32dp"
android:layout_marginBottom="32dp"
app:layout_constraintBottom_toBottomOf="parent"
app:layout_constraintEnd_toEndOf="parent"
app:srcCompat="@drawable/add" />
</androidx.constraintlayout.widget.ConstraintLayout>
五、项目源码
👇👇👇👇👇快捷方式👇👇👇👇👇