Android 簡單記賬本的實現(使用LitePal數據庫)


1.主要功能展示:

1.登錄

 1.注冊

 

3.主界面:

 

4.1記一筆(1.收入):

 

4.2記一筆(2.支出):

 

5.1賬單(1.收入)

 

5.2賬單(2.支出)

 

6.導出(已XLS格式導出到SD卡)

 

 

 2. 詳細代碼實現(布局,關鍵代碼)

2.1布局:

登錄界面:

  

<?xml version="1.0" encoding="utf-8"?>
<FrameLayout 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:background="@drawable/background"
tools:context=".LoginActivity">
<LinearLayout
android:id="@+id/linear1"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:visibility="gone"
android:layout_marginTop="200dp">
<LinearLayout
android:layout_width="match_parent"
android:layout_height="match_parent"
android:gravity="center"
android:orientation="vertical">

<LinearLayout
android:layout_width="match_parent"
android:layout_height="wrap_content"
android:background="#99404348"
android:gravity="center"
android:paddingTop="20dp"
android:paddingBottom="30dp">

<TextView
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:layout_gravity="center"
android:text="Welcome"
android:textColor="#FFFFFF"
android:textSize="18sp" />
</LinearLayout>

<LinearLayout
android:layout_width="match_parent"
android:layout_height="wrap_content"
android:background="#99000000"
android:orientation="vertical"
android:paddingTop="20dp"
android:paddingBottom="20dp">

<EditText
android:id="@+id/edt_Login"
android:text="18730973637"
android:layout_width="match_parent"
android:layout_height="wrap_content"
android:layout_gravity="center"
android:layout_marginLeft="50dp"
android:layout_marginRight="50dp"
android:background="@null"
android:hint="your username"
android:textColor="#9F9FA0"
android:textColorHint="#9F9FA0" />

<View
android:layout_width="match_parent"
android:layout_height="1dip"
android:layout_marginLeft="40dp"
android:layout_marginTop="10dp"
android:layout_marginRight="40dp"
android:layout_marginBottom="5dp"
android:background="#83738F"></View>

<EditText
android:id="@+id/edt_pwd"
android:text="3986479a"
android:inputType="textPassword"
android:layout_width="match_parent"
android:layout_height="wrap_content"
android:layout_gravity="center"
android:layout_marginLeft="50dp"
android:layout_marginRight="50dp"
android:background="@null"
android:hint="your password"
android:textColor="#9F9FA0"
android:textColorHint="#9F9FA0" />
</LinearLayout>

<LinearLayout
android:layout_width="match_parent"
android:layout_height="wrap_content"
android:background="#99404348"
android:gravity="center"
android:orientation="horizontal"
android:paddingTop="20dp"
android:paddingBottom="30dp">

<TextView
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:layout_marginRight="20dp"
android:layout_gravity="center"
android:text="Forget Password?"
android:textColor="#DDDDDD"
android:onClick="btn_Forget"
android:textSize="15sp" />

<TextView
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:layout_gravity="center"
android:text="Register"
android:onClick="btn_Register"
android:layout_marginLeft="20dp"
android:textColor="#FFFFFF"
android:textSize="15sp" />
</LinearLayout>

<LinearLayout
android:layout_width="match_parent"
android:layout_height="wrap_content"
android:orientation="horizontal">

<com.dd.CircularProgressButton
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:layout_marginLeft="10dp"
android:layout_marginRight="10dp"
android:layout_weight="1"
android:id="@+id/btn_Login"
android:background="@drawable/btn_circle"
android:text="Login"
android:onClick="btn_CallLogin"/>
</LinearLayout>
</LinearLayout>
</LinearLayout>
</FrameLayout>


只適合初學者,這里代碼太多了,我就放到百度網盤了。
網盤地址:https://pan.baidu.com/s/10T9ZHrOB0gqdZyjLtd-KKw
提取碼: 5pef

 


免責聲明!

本站轉載的文章為個人學習借鑒使用,本站對版權不負任何法律責任。如果侵犯了您的隱私權益,請聯系本站郵箱yoyou2525@163.com刪除。



 
粵ICP備18138465號   © 2018-2025 CODEPRJ.COM