2021年寒假生活日報告-第六天 (android開發記賬本進度五)
阿新 • • 發佈:2021-01-10
今日android開發進度:
res/layout/xml檔案:
1.activity_main.xml
<?xml version="1.0" encoding="utf-8"?>
<androidx.coordinatorlayout.widget.CoordinatorLayout
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">
<com.google.android.material.appbar.AppBarLayout
android:layout_height="wrap_content"
android:layout_width="match_parent"
android:theme="@style/AppTheme.AppBarOverlay">
<androidx.appcompat.widget.Toolbar
android:id="@+id/toolbar"
android:layout_width="match_parent"
android:layout_height="?attr/actionBarSize"
android:background="?attr/colorPrimary"
app:popupTheme="@style/AppTheme.PopupOverlay" />
</com.google.android.material.appbar.AppBarLayout>
<include layout="@layout/content_main"/>
</androidx.coordinatorlayout.widget.CoordinatorLayout>
2.content_main.xml
<?xml version="1.0" encoding="utf-8"?>
<RelativeLayout
xmlns:android="http://schemas.android.com/apk/res/android"
xmlns:tools="http://schemas.android.com/tools"
xmlns:app="http://schemas.android.com/apk/res-auto"
android:layout_width="match_parent"
android:layout_height="match_parent"
app:layout_behavior="@string/appbar_scrolling_view_behavior"
tools:showIn="@layout/activity_main"
tools:context=".MainActivity">
<TextView
android:id="@+id/tv_cost_total"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:textSize="20dp"
android:text="賬戶餘額:0"/>
<ListView
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:id="@+id/lv_main"/>
<LinearLayout
android:layout_width="match_parent"
android:layout_height="wrap_content"
android:layout_alignParentBottom="true">
<Button
android:id="@+id/btn_add_in"
android:layout_width="0dp"
android:layout_height="match_parent"
android:layout_weight="1"
android:background="#8A7532EB"
android:drawablePadding="3dp"
android:gravity="center"
android:text="收入" />
<Button
android:id="@+id/btn_add_out"
android:layout_width="0dp"
android:layout_height="match_parent"
android:layout_weight="1"
android:background="#9F03A9F4"
android:drawablePadding="3dp"
android:gravity="center"
android:text="支出" />
<Button
android:id="@+id/btn_delete"
android:layout_width="0dp"
android:layout_height="match_parent"
android:layout_weight="1"
android:background="#86FFC107"
android:drawablePadding="3dp"
android:gravity="center"
android:text="刪除" />
<Button
android:id="@+id/btn_delete_all"
android:layout_width="0dp"
android:layout_height="match_parent"
android:layout_weight="1"
android:background="#79E91E63"
android:drawablePadding="3dp"
android:gravity="center"
android:text="清空賬單" />
</LinearLayout>
</RelativeLayout>
3.list_item.xml
<?xml version="1.0" encoding="utf-8"?>
<LinearLayout xmlns:android="http://schemas.android.com/apk/res/android"
android:orientation="horizontal"
android:layout_width="match_parent"
android:layout_height="80dp">
<TextView
android:id="@+id/tv_title"
android:layout_width="125dp"
android:layout_height="80dp"
android:layout_alignParentLeft="true"
android:layout_marginLeft="10dp"
android:ellipsize="marquee"
android:gravity="center"
android:singleLine="true"
android:text="costTitle"
android:textSize="35sp" />
<TextView
android:id="@+id/tv_date"
android:layout_width="100dp"
android:layout_height="80dp"
android:layout_marginLeft="15dp"
android:layout_toRightOf="@+id/tv_title"
android:gravity="center"
android:text="costDate"
android:textSize="20sp" />
<TextView
android:id="@+id/tv_cost"
android:layout_width="100dp"
android:layout_height="80dp"
android:layout_alignParentRight="true"
android:layout_marginRight="20dp"
android:gravity="center"
android:text="30000"
android:textSize="25sp" />
</LinearLayout>
4.delete_cost_data.xml
<?xml version="1.0" encoding="utf-8"?>
<LinearLayout xmlns:android="http://schemas.android.com/apk/res/android"
android:orientation="vertical" android:layout_width="match_parent"
android:gravity="center"
android:layout_height="match_parent">
<EditText
android:id="@+id/et_cost_title"
android:layout_width="match_parent"
android:layout_height="match_parent"
android:layout_margin="4dp"
android:hint="請輸入要刪除的Cost Title"/>
</LinearLayout>
5.new_cost_data.xml
<?xml version="1.0" encoding="utf-8"?>
<LinearLayout xmlns:android="http://schemas.android.com/apk/res/android"
android:orientation="vertical" android:layout_width="match_parent"
android:gravity="center"
android:layout_height="match_parent">
<EditText
android:id="@+id/et_cost_title"
android:layout_width="match_parent"
android:layout_height="match_parent"
android:layout_margin="4dp"
android:hint="Cost Title"/>
<EditText
android:id="@+id/et_cost_money"
android:layout_width="match_parent"
android:layout_height="wrap_content"
android:layout_margin="4dp"
android:hint="Cost Money"/>
<DatePicker
android:id="@+id/dp_cost_date"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:layout_margin="4dp"
android:datePickerMode="spinner"
android:calendarViewShown="false"/>
<!-- <LinearLayout-->
<!-- android:layout_width="wrap_content"-->
<!-- android:layout_height="wrap_content"-->
<!-- android:orientation="horizontal">-->
<!-- <TextView-->
<!-- android:layout_width="match_parent"-->
<!-- android:layout_height="wrap_content"-->
<!-- android:text="交易型別:"-->
<!-- android:textSize="20dp"-->
<!-- android:height="100px"/>-->
<!-- <RadioGroup-->
<!-- android:id="@+id/et_cost_kind"-->
<!-- android:layout_width="wrap_content"-->
<!-- android:layout_height="wrap_content"-->
<!-- android:orientation="horizontal">-->
<!-- <RadioButton-->
<!-- android:id="@+id/et_cost_kind_in"-->
<!-- android:layout_width="wrap_content"-->
<!-- android:layout_height="wrap_content"-->
<!-- android:text="收入"/>-->
<!-- <RadioButton-->
<!-- android:id="@+id/et_cost_kind_out"-->
<!-- android:layout_width="wrap_content"-->
<!-- android:layout_height="wrap_content"-->
<!-- android:text="支出"/>-->
<!-- </RadioGroup>-->
<!-- </LinearLayout>-->
</LinearLayout>
6.chart_view.xml
<?xml version="1.0" encoding="utf-8"?>
<LinearLayout xmlns:android="http://schemas.android.com/apk/res/android"
android:orientation="vertical"
android:layout_width="match_parent"
android:layout_height="match_parent"
android:padding="10dp">
<lecho.lib.hellocharts.view.LineChartView
android:id="@+id/chart"
android:layout_width="match_parent"
android:layout_height="match_parent"
android:padding="20dp" />
</LinearLayout>