今天開始進行記賬本的開發。
主要想法表述:
1、與用戶界面交互的主要有三個界面,總資金管理,收入界面管理,支出管理。
2、實現登錄注冊功能,在數據庫中不同用戶有着不同的數據記錄。
其他細節在具體開發中進行實現。
今天實現的幾個Activity和Fragment的布局界面設計,沒有內部邏輯,簡單實現UI界面。
首先,Android Studio為我們提供了一種比較好用的抽屜模板Activity,我們可以使用它方便的實現UI界面的設計。
我們可以直接新建navigation drawer activity來使用這種Activity。
根據這個模板,把抽屜欄樣式設定成記賬本,如下效果:
預期每一個都是一個功能模塊,之后實現Activity的跳轉。
之后是主界面的設計,使用3個Fragment完成summary、income和outlay的界面布局。
在content_main.xml中,完成3個fragment的切換。
<?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" app:layout_behavior="@string/appbar_scrolling_view_behavior" android:id="@+id/layoutContent" tools:showIn="@layout/app_bar_main"> <!--主界面的內容--> <androidx.viewpager.widget.ViewPager android:id="@+id/viewpager" android:layout_width="match_parent" android:layout_height="match_parent" android:layout_above="@id/navigation"> </androidx.viewpager.widget.ViewPager> <com.google.android.material.bottomnavigation.BottomNavigationView android:id="@+id/navigation" android:layout_width="match_parent" android:layout_height="wrap_content" android:background="?android:attr/windowBackground" android:layout_alignParentBottom="true" app:menu="@menu/navigation"> </com.google.android.material.bottomnavigation.BottomNavigationView> </RelativeLayout>
其中navigation是自定義的menu文件。
效果如下
並分別創建SummaryFragment、IncomeFragment和OutlayFragment,對應下方的三個圖標。
今天不進行內部邏輯的編寫,故主要將前端界面大體描繪了一下,后期再添加細節。
對於收入支出,主要思路是用listView展現出來,但內容來自數據庫,故此處只將測試內容編寫,之后再改即可。
本次完成了整體上記賬本的應用布局及界面設計,后期還會做出很多修改。