1. 功能模块思维导图
2. 项目涉及到的技术点
- 使用CountDownTimer实现欢迎页倒计时
- 使用okhttp实现网络请求(springboot搭建服务端)
- 使用glide实现图片加载
- 使用gson实现json数据解析
- 使用banner实现首页轮播图
- 使用BottomNavigationView实现底部导航栏
- 使用TabLayout+ViewPager2实现滑动分类
- 使用RecyclerView实现商品,订单等列表
- 使用pictureselector实现本地图库图片选择
3. 开发环境
app安卓端
- 开发工具:Androidstudio(版本不是很低就行)
- 开发语言:Java
- jdk版本:11+以上
服务端
- 开发工具:IDEA
- 开发语言:Java
- jdk版本:11+以上
- MySQL数据库:8.0+y以上
4. 运行效果图
5. 部分代码实现
- 注册activity.register.xml布局页面
<?xml version="1.0" encoding="utf-8"?>
<androidx.appcompat.widget.LinearLayoutCompat 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">
<androidx.appcompat.widget.Toolbar
android:id="@+id/toolbar"
android:layout_width="match_parent"
android:layout_height="wrap_content"
android:background="@color/teal_200"
app:navigationIcon="@mipmap/img_back"
app:title="用户注册"
app:titleTextColor="@color/white" />
<androidx.cardview.widget.CardView
android:layout_width="80dp"
android:layout_height="80dp"
android:layout_gravity="center_horizontal"
android:layout_marginTop="100dp"
app:cardCornerRadius="40dp"
app:cardElevation="0dp">
<androidx.appcompat.widget.AppCompatImageView
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:src="@mipmap/app_logo" />
</androidx.cardview.widget.CardView>
<androidx.appcompat.widget.LinearLayoutCompat
android:layout_width="match_parent"
android:layout_height="wrap_content"
android:layout_marginLeft="20dp"
android:layout_marginTop="50dp"
android:layout_marginRight="20dp"
android:orientation="vertical">
<androidx.cardview.widget.CardView
android:layout_width="match_parent"
android:layout_height="50dp"
app:cardBackgroundColor="#f5f5f5"
app:cardCornerRadius="25dp"
app:cardElevation="0dp">
<androidx.appcompat.widget.LinearLayoutCompat
android:layout_width="match_parent"
android:layout_height="match_parent"
android:paddingLeft="10dp"
android:paddingRight="10dp">
<TextView
android:layout_width="wrap_content"
android:layout_height="match_parent"
android:gravity="center"
android:text="用户名:"
android:textColor="@color/text_color" />
<EditText
android:id="@+id/username"
android:layout_width="match_parent"
android:layout_height="match_parent"
android:layout_marginLeft="10dp"
android:background="@null"
android:hint="请输入用户名"
android:textSize="14sp" />
</androidx.appcompat.widget.LinearLayoutCompat>
</androidx.cardview.widget.CardView>
<androidx.cardview.widget.CardView
android:layout_width="match_parent"
android:layout_height="50dp"
android:layout_marginTop="10dp"
app:cardBackgroundColor="#f5f5f5"
app:cardCornerRadius="25dp"
app:cardElevation="0dp">
<androidx.appcompat.widget.LinearLayoutCompat
android:layout_width="match_parent"
android:layout_height="match_parent"
android:paddingLeft="10dp"
android:paddingRight="10dp">
<TextView
android:layout_width="wrap_content"
android:layout_height="match_parent"
android:gravity="center"
android:text="手机号:"
android:textColor="@color/text_color" />
<EditText
android:id="@+id/mobile"
android:layout_width="match_parent"
android:layout_height="match_parent"
android:layout_marginLeft="10dp"
android:background="@null"
android:hint="请输入手机号"
android:inputType="number"
android:maxLength="11"
android:textSize="14sp" />
</androidx.appcompat.widget.LinearLayoutCompat>
</androidx.cardview.widget.CardView>
<androidx.cardview.widget.CardView
android:layout_width="match_parent"
android:layout_height="50dp"
android:layout_marginTop="10dp"
app:cardBackgroundColor="#f5f5f5"
app:cardCornerRadius="25dp"
app:cardElevation="0dp">
<androidx.appcompat.widget.LinearLayoutCompat
android:layout_width="match_parent"
android:layout_height="match_parent"
android:paddingLeft="10dp"
android:paddingRight="10dp">
<TextView
android:layout_width="wrap_content"
android:layout_height="match_parent"
android:gravity="center"
android:text="密码:"
android:textColor="@color/text_color" />
<EditText
android:id="@+id/password"
android:layout_width="match_parent"
android:layout_height="match_parent"
android:layout_marginLeft="10dp"
android:background="@null"
android:hint="请输入密码"
android:inputType="number"
android:maxLength="11"
android:textSize="14sp" />
</androidx.appcompat.widget.LinearLayoutCompat>
</androidx.cardview.widget.CardView>
<androidx.cardview.widget.CardView
android:layout_width="match_parent"
android:layout_height="50dp"
android:layout_marginTop="20dp"
app:cardBackgroundColor="@color/teal_200"
app:cardCornerRadius="25dp"
app:cardElevation="0dp">
<Button
android:id="@+id/register"
android:layout_width="match_parent"
android:layout_height="match_parent"
android:background="@color/teal_200"
android:text="注册" />
</androidx.cardview.widget.CardView>
</androidx.appcompat.widget.LinearLayoutCompat>
</androidx.appcompat.widget.LinearLayoutCompat>
效果图
2. 登录activity_login.xml布局页面
<?xml version="1.0" encoding="utf-8"?>
<RelativeLayout 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"
tools:context="com.school.trading.activity.UserLoginActivity">
<androidx.appcompat.widget.LinearLayoutCompat
android:layout_width="match_parent"
android:layout_height="wrap_content"
android:orientation="vertical">
<androidx.appcompat.widget.Toolbar
android:layout_width="match_parent"
android:layout_height="wrap_content"
android:background="@color/teal_200"
app:title="用户登录"
app:titleTextColor="@color/white">
</androidx.appcompat.widget.Toolbar>
<androidx.cardview.widget.CardView
android:layout_width="80dp"
android:layout_height="80dp"
android:layout_gravity="center_horizontal"
android:layout_marginTop="100dp"
app:cardCornerRadius="40dp"
app:cardElevation="0dp">
<androidx.appcompat.widget.AppCompatImageView
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:src="@mipmap/app_logo" />
</androidx.cardview.widget.CardView>
<androidx.appcompat.widget.LinearLayoutCompat
android:layout_width="match_parent"
android:layout_height="wrap_content"
android:layout_marginLeft="20dp"
android:layout_marginTop="50dp"
android:layout_marginRight="20dp"
android:orientation="vertical">
<androidx.cardview.widget.CardView
android:layout_width="match_parent"
android:layout_height="50dp"
app:cardBackgroundColor="#f5f5f5"
app:cardCornerRadius="25dp"
app:cardElevation="0dp">
<androidx.appcompat.widget.LinearLayoutCompat
android:layout_width="match_parent"
android:layout_height="match_parent"
android:paddingLeft="10dp"
android:paddingRight="10dp">
<TextView
android:layout_width="wrap_content"
android:layout_height="match_parent"
android:gravity="center"
android:text="用户名:"
android:textColor="@color/text_color" />
<EditText
android:id="@+id/username"
android:layout_width="match_parent"
android:layout_height="match_parent"
android:layout_marginLeft="10dp"
android:background="@null"
android:hint="请输入用户名"
android:textSize="14sp" />
</androidx.appcompat.widget.LinearLayoutCompat>
</androidx.cardview.widget.CardView>
<androidx.cardview.widget.CardView
android:layout_width="match_parent"
android:layout_height="50dp"
android:layout_marginTop="10dp"
app:cardBackgroundColor="#f5f5f5"
app:cardCornerRadius="25dp"
app:cardElevation="0dp">
<androidx.appcompat.widget.LinearLayoutCompat
android:layout_width="match_parent"
android:layout_height="match_parent"
android:paddingLeft="10dp"
android:paddingRight="10dp">
<TextView
android:layout_width="wrap_content"
android:layout_height="match_parent"
android:gravity="center"
android:text="密码:"
android:textColor="@color/text_color" />
<EditText
android:id="@+id/password"
android:layout_width="match_parent"
android:layout_height="match_parent"
android:layout_marginLeft="10dp"
android:background="@null"
android:hint="请输入密码"
android:inputType="textPassword"
android:textSize="14sp" />
</androidx.appcompat.widget.LinearLayoutCompat>
</androidx.cardview.widget.CardView>
<CheckBox
android:id="@+id/checkbox"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:text="记住密码"/>
<androidx.cardview.widget.CardView
android:layout_width="match_parent"
android:layout_height="50dp"
android:layout_marginTop="20dp"
app:cardBackgroundColor="@color/teal_200"
app:cardCornerRadius="25dp"
app:cardElevation="0dp">
<Button
android:id="@+id/login"
android:layout_width="match_parent"
android:layout_height="match_parent"
android:background="@color/teal_200"
android:text="登录" />
</androidx.cardview.widget.CardView>
<TextView
android:id="@+id/register"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:layout_gravity="right"
android:backgroundTint="@color/white"
android:padding="10dp"
android:text="还未注册?"
android:textColor="@color/teal_200" />
</androidx.appcompat.widget.LinearLayoutCompat>
</androidx.appcompat.widget.LinearLayoutCompat>
</RelativeLayout>
效果图
6. 部分视频教程
-
Androidstudio底部导航栏实现:https://www.bilibili.com/video/BV1XB4y1d7et/?vd_source=984bb03f768809c7d33f20179343d8c8
-
Androidstudio登录注册UI实现: https://www.bilibili.com/video/BV14u411T7Y7/?vd_source=984bb03f768809c7d33f20179343d8c8