寒假打卡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>
【推荐】国内首个AI IDE,深度理解中文开发场景,立即下载体验Trae
【推荐】编程新体验,更懂你的AI,立即体验豆包MarsCode编程助手
【推荐】抖音旗下AI助手豆包,你的智能百科全书,全免费不限次数
【推荐】轻量又高性能的 SSH 工具 IShell:AI 加持,快人一步
· 震惊!C++程序真的从main开始吗?99%的程序员都答错了
· 【硬核科普】Trae如何「偷看」你的代码?零基础破解AI编程运行原理
· 单元测试从入门到精通
· 上周热点回顾(3.3-3.9)
· winform 绘制太阳,地球,月球 运作规律