Android记事本

该文描述了一个Android记事本应用的需求分析、设计和关键代码实现。主要包括记事的显示、添加、编辑和查询功能,以及用户账户的注册和登录。应用使用SQLite数据库存储用户信息和记事内容,界面采用简约风格,包含多个活动页面。此外,文中还展示了部分页面布局代码和登录、注册的实现类代码,并提供了测试用例。

摘要生成于 C知道 ,由 DeepSeek-R1 满血版支持, 前往体验 >

1、项目需求分析

1.1、记事功能需求分析:

1.1.1、显示记事

用户打开记事本可以看到之前所写的所有记事内容,进入主页后,软件应该从数据库中搜索出该用户所写的全部记事,并将所有的数据进行显示。

1.1.2、添加记事

设置添加按钮,点击添加按钮之后可以编辑记事的标题和内容。

1.1.3、编辑记事

在主界面的记事列表中,点击一条记事,能够进行编辑,包括更改记事和删除记事。

1.1.4、查询记事

在主界面中设置查询功能,使用户可以通过对标题进行模糊查询。

1.2、账户管理

为了保护用户的隐私,在使用记事本时首先需要进行用户的登录,在登录账号之后才可以使用记事本的功能。

1.2.1、注册账号

使用记事本功能首先需要进行用户的注册,在注册过程中应注意用户名以及密码的正确输入才可注册成功。

1.2.2、登录

登录时需要对账号以及密码进行检测,如果账号密码正确即可进入记事本页面,使用记事本功能。

1.3、数据库需求分析

在该项目中使用了两个数据库表,分别为存储用户信息的users表以及存储记事本内容的note表。

1.4、界面需求分析

在该项目中,一个有六个页面,分别是用户界面activity_user、注册页面activity_register、记事本主页面activity_main、添加页面activity_add、编辑页面activity_edit、删除页面List_item_dialog。

总体布局以及背景色调使用简约风格。

2项目的设计

2.1、注册功能

图 1 注册功能

2.2、登录功能

 

图 2 登录功能

2.3、记事功能

图 3 记事功能

3关键的代码

3.1、页面代码(部分)

3.1.1、用户界面activity_user.xml

<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"

    tools:context=".MainActivity"

    android:orientation="vertical">

    <androidx.appcompat.widget.Toolbar

        android:id="@+id/toolbar"

        android:layout_width="match_parent"

        android:layout_height="?attr/actionBarSize"

        android:background="?attr/colorPrimary"

        android:elevation="4dp"

        app:popupTheme="@style/ThemeOverlay.AppCompat.Light"

        app:title="@string/app_name">

    </androidx.appcompat.widget.Toolbar>

    <LinearLayout

        android:layout_width="match_parent"

        android:layout_height="wrap_content"

        android:orientation="horizontal"

        android:layout_marginLeft="20dp"

        android:layout_marginRight="20dp"

        android:layout_marginTop="40dp"

        android:gravity="center_vertical"

        >

        <TextView

            android:layout_width="wrap_content"

            android:layout_height="wrap_content"

            android:text="账号:"

            android:textSize="25sp"

            />

        <EditText

            android:id="@+id/et_account"

            android:layout_width="match_parent"

            android:hint="请输入用户名或手机号"

            android:layout_marginLeft="10dp"

            style="@style/MyEditStyle"

            android:inputType="text"

            />

    </LinearLayout>

    <LinearLayout

        android:layout_width="match_parent"

        android:layout_height="wrap_content"

        android:orientation="horizontal"

        android:layout_marginLeft="20dp"

        android:layout_marginRight="20dp"

        android:layout_marginTop="20dp"

        android:gravity="center_vertical"

        >

        <TextView

            android:layout_width="wrap_content"

            android:layout_height="wrap_content"

            android:text="密码:"

            android:textSize="25sp"

            />

        <EditText

            android:id="@+id/et_password"

            android:layout_width="match_parent"

            android:layout_height="50dp"

            android:hint="请输入密码"

            android:textSize="18sp"

            android:layout_marginLeft="10dp"

            android:paddingLeft="5dp"

            android:inputType="numberPassword"

            android:background="@drawable/edit_text_bg"

            />

    </L

评论 2
添加红包

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

当前余额3.43前往充值 >
需支付:10.00
成就一亿技术人!
领取后你会自动成为博主和红包主的粉丝 规则
hope_wisdom
发出的红包
实付
使用余额支付
点击重新获取
扫码支付
钱包余额 0

抵扣说明:

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

余额充值