content_main.xml
<?xml version="1.0" encoding="utf-8"?>
<android.support.constraint.ConstraintLayout
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="com.example.administrator.jizhangbook.MainActivity">
<ListView
android:layout_width="368dp"
android:layout_height="495dp"
android:id="@+id/lv_main"
tools:layout_editor_absoluteY="8dp"
tools:layout_editor_absoluteX="8dp"
/>
</android.support.constraint.ConstraintLayout>
list_item.xml
<?xml version="1.0" encoding="utf-8"?>
<RelativeLayout xmlns:android="http://schemas.android.com/apk/res/android"
android:layout_width="match_parent"
android:layout_height="60dp"
android:descendantFocusability="blocksDescendants">
<TextView
android:id="@+id/tv_title"
android:layout_width="120dp"
android:layout_height="60dp"
android:layout_alignParentLeft="true"
android:gravity="center"
android:singleLine="true"
android:ellipsize="marquee"
android:textSize="25sp"
android:text="costtitle"/>
<TextView
android:layout_width="wrap_content"
android:layout_height="60dp"
android:id="@+id/tv_cost"
android:layout_toRightOf="@id/tv_title"
android:layout_marginLeft="15dp"
android:text="cost"
android:gravity="center"
android:textSize="30sp"
/>
<TextView
android:layout_width="wrap_content"
android:layout_height="60dp"
android:id="@+id/tv_date"
android:gravity="center"
android:text="cost_date"
android:textSize="20sp"
android:layout_marginRight="40dp"
android:layout_alignParentRight="true"
/>
</RelativeLayout>
//自定的對話框
new_cost.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">
<EditText
android:layout_width="match_parent"
android:layout_height="wrap_content"
android:id="@+id/ct_cost_title"
android:layout_margin="4dp"
android:hint="幹了什麼"/>
<EditText
android:layout_width="match_parent"
android:layout_height="wrap_content"
android:id="@+id/ct_cost_money"
android:layout_margin="4dp"
android:hint="花了多少錢"
android:inputType="number"/>
<DatePicker
android:layout_width="match_parent"
android:layout_height="wrap_content"
android:id="@+id/ct_cost_date"
android:layout_margin="4dp"
android:datePickerMode="spinner"
android:calendarViewShown="false"/>
</LinearLayout>
//第三方庫
char_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:padding="20dp"
android:layout_width="match_parent"
android:layout_height="match_parent" />
</LinearLayout>