寒假打卡day27
今天做了什么
教程第七天
可以看到我们必须给之前的Onclick事件写一个方法(addAccount)。即点击+号按钮跳转到一个新页面,在这个新页面,我们要完成输入Title、Date、Money的操作。
这就需要新建一个Activity,命名为new_cost
生成Activity时系统会同时生成一个java文件和一个layout文件,名为activity_new_cost.xml
在这个文件中开始写新建项的布局
<?xml version="1.0" encoding="utf-8"?>
<LinearLayout
xmlns:android="http://schemas.android.com/apk/res/android"
android:layout_width="match_parent"
android:layout_height="match_parent"
android:orientation="vertical"
android:gravity="center">
<EditText
android:id="@+id/et_cost_title"
android:layout_width="match_parent"
android:layout_height="wrap_content"
android:layout_margin="4dp"
android:hint="Cost Title"
android:textColor="#ffbd27"
/>
<EditText
android:id="@+id/et_cost_money"
android:inputType="number|numberDecimal"
android:layout_width="match_parent"
android:layout_height="wrap_content"
android:layout_margin="4dp"
android:hint="Cost Money"
android:textColor="#ffbd27"
/>
<DatePicker
android:id="@+id/dp_cost_date"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:layout_margin="8dp"
android:datePickerMode="spinner"
android:calendarViewShown="false"
/>
<Button
android:onClick="okButton"
android:layout_width="match_parent"
android:layout_height="wrap_content"
android:text="确认"
android:textSize="20dp"
android:textColor="#333333"
android:background="#ffbd27"
android:layout_marginLeft="40dp"
android:layout_marginRight="40dp"
/>
</LinearLayout>

浙公网安备 33010602011771号