基于Android Studio宠物领养app实现

1. 项目功能思维导图

在这里插入图片描述

2. 项目涉及到的技术点

  1. 使用MySQL数据库实现数据存储
  2. 使用CountDownTimer实现启动页倒计时
  3. 使用SharedPreferences实现记住密码登录
  4. 使用BottomNavigationView实现底部导航栏
  5. 使用Activity+Fragment实现底部导航栏页面之间切换
  6. 使用RecyclerView+Adapter实现宠物信息列表
  7. 使用TabLayout+ViewPager实现宠物滑动分类
  8. 使用CardView卡片控件实现头像圆角
  9. 使用AlertDialog实现退出登录提醒框
  10. 使用springBoot搭建服务端
  11. 使用okhttp实现app端和服务端数据通讯

3. 开发环境

app端

  1. 开发工具:Androidstudio
  2. 开发语言:Java
  3. jdk版本:11+以上

服务端

  1. 开发工具:IDEA
  2. 开发语言:Java
  3. 开发框架:springBoot

4. 项目运行效果图

请添加图片描述请添加图片描述
请添加图片描述
在这里插入图片描述
在这里插入图片描述

5. 部分功能实现过程

  1. 底部导航栏布局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>
  1. 底部导航栏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. 视频教程学习

  1. Androidstudio底部导航栏实现: https://www.bilibili.com/video/BV1MQ4y1H7wM/?spm_id_from=333.337.search-card.all.click&vd_source=984bb03f768809c7d33f20179343d8c8

  2. Android安卓项目目录介绍,如何正确运行Android项目: https://blog.csdn.net/jky_yihuangxing/article/details/141933510

  3. springBoot项目目录介绍,如何启动springBoot项目: https://blog.csdn.net/jky_yihuangxing/article/details/141926182

评论
添加红包

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

当前余额3.43前往充值 >
需支付:10.00
成就一亿技术人!
领取后你会自动成为博主和红包主的粉丝 规则
hope_wisdom
发出的红包

打赏作者

浩宇软件开发

你的鼓励将是我创作的最大动力

¥1 ¥2 ¥4 ¥6 ¥10 ¥20
扫码支付:¥1
获取中
扫码支付

您的余额不足,请更换扫码支付或充值

打赏作者

实付
使用余额支付
点击重新获取
扫码支付
钱包余额 0

抵扣说明:

1.余额是钱包充值的虚拟货币,按照1:1的比例进行支付金额的抵扣。
2.余额无法直接购买下载,可以购买VIP、付费专栏及课程。

余额充值