1. 项目功能思维导图
2. 项目涉及到的技术点
- 使用MySQL数据库实现数据存储
- 使用CountDownTimer实现启动页倒计时
- 使用SharedPreferences实现记住密码登录
- 使用BottomNavigationView实现底部导航栏
- 使用Activity+Fragment实现底部导航栏页面之间切换
- 使用RecyclerView+Adapter实现宠物信息列表
- 使用TabLayout+ViewPager实现宠物滑动分类
- 使用CardView卡片控件实现头像圆角
- 使用AlertDialog实现退出登录提醒框
使用springBoot搭建服务端
使用okhttp实现app端和服务端数据通讯
3. 开发环境
app端
- 开发工具:Androidstudio
- 开发语言:Java
- jdk版本:11+以上
服务端
- 开发工具:IDEA
- 开发语言:Java
- 开发框架:springBoot
web端
- 开发工具:Vscode
- 开发环境:Nodejs
- Element UI +Vue 实现框架搭建
4. 项目运行效果图
5. 部分功能实现过程
- 底部导航栏布局activity_main.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">
<FrameLayout
android:id="@+id/content"
android:layout_width="match_parent"
android:layout_height="match_parent"
android:layout_above="@id/rel" />
<RelativeLayout
android:id="@+id/rel"
android:layout_width="match_parent"
android:layout_height="wrap_content"
android:layout_alignParentBottom="true">
<com.google.android.material.bottomnavigation.BottomNavigationView
android:id="@+id/bottomNavigationView"
android:layout_width="match_parent"
android:layout_height="wrap_content"
android:elevation="100dp"
app:menu="@menu/navigation" />
</RelativeLayout>
<androidx.cardview.widget.CardView
android:id="@+id/btn_push"
android:layout_width="50dp"
android:layout_height="50dp"
android:layout_alignParentBottom="true"
android:layout_centerHorizontal="true"
android:layout_marginBottom="10dp"
android:backgroundTint="@color/purple_200"
app:cardCornerRadius="25dp">
<ImageView
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:layout_gravity="center"
android:src="@drawable/baseline_add_24" />
</androidx.cardview.widget.CardView>
</RelativeLayout>
- 底部导航栏MainActivity.java实现
public class MainActivity extends BaseActivity {
private HomeFragment mHomeFragment;
private MineFragment mMineFragment;
private BottomNavigationView bottomNavigationView;
@Override
protected int getLayoutId() {
return R.layout.activity_main;
}
@Override
protected void initView() {
bottomNavigationView = findViewById(R.id.bottomNavigationView);
bottomNavigationView.setOnNavigationItemSelectedListener(new BottomNavigationView.OnNavigationItemSelectedListener() {
@Override
public boolean onNavigationItemSelected(@NonNull MenuItem item) {
if (item.getItemId() == R.id.push) {
startActivity(new Intent(MainActivity.this, PushActivity.class));
} else if (item.getItemId() == R.id.home) {
selectedFragment(0);
return true;
} else {
selectedFragment(2);
return true;
}
return false;
}
});
}
@Override
protected void initListener() {
findViewById(R.id.btn_push).setOnClickListener(new View.OnClickListener() {
@Override
public void onClick(View v) {
startActivity(new Intent(MainActivity.this, PushActivity.class));
}
});
}
@Override
protected void initData() {
selectedFragment(0);
}
private void selectedFragment(int position) {
FragmentTransaction fragmentTransaction = getSupportFragmentManager().beginTransaction();
hideFragment(fragmentTransaction);
if (position == 0) {
if (mHomeFragment == null) {
mHomeFragment = new HomeFragment();
fragmentTransaction.add(R.id.content, mHomeFragment);
} else {
fragmentTransaction.show(mHomeFragment);
}
} else if (position == 2) {
if (mMineFragment == null) {
mMineFragment = new MineFragment();
fragmentTransaction.add(R.id.content, mMineFragment);
} else {
fragmentTransaction.show(mMineFragment);
}
}
//提交
fragmentTransaction.commit();
}
private void hideFragment(FragmentTransaction fragmentTransaction) {
if (mHomeFragment != null) {
fragmentTransaction.hide(mHomeFragment);
}
if (mMineFragment != null) {
fragmentTransaction.hide(mMineFragment);
}
}
}
6. 视频教程学习
-
Androidstudio底部导航栏实现: https://www.bilibili.com/video/BV1MQ4y1H7wM/?spm_id_from=333.337.search-card.all.click&vd_source=984bb03f768809c7d33f20179343d8c8
-
Android安卓项目目录介绍,如何正确运行Android项目: https://blog.csdn.net/jky_yihuangxing/article/details/141933510
-
springBoot项目目录介绍,如何启动springBoot项目: https://blog.csdn.net/jky_yihuangxing/article/details/141926182