寒假打卡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>

 

posted @   夏季彼岸德  阅读(2)  评论(0编辑  收藏  举报
相关博文:
阅读排行:
· 震惊!C++程序真的从main开始吗?99%的程序员都答错了
· 【硬核科普】Trae如何「偷看」你的代码?零基础破解AI编程运行原理
· 单元测试从入门到精通
· 上周热点回顾(3.3-3.9)
· winform 绘制太阳,地球,月球 运作规律
点击右上角即可分享
微信分享提示