3.22
第十三天 | |
所花时间 | 3h |
代码量 | 100行 |
博客量 | 1篇 |
所学的知识 | android studio页面的制作以及时间的添加 |
public class stud extends AppCompatActivity { ImageView addButton; private TextView dateTextView; @SuppressLint("WrongViewCast") @Override protected void onCreate(Bundle savedInstanceState) { super.onCreate(savedInstanceState); setContentView(R.layout.activity_stud); dateTextView = findViewById(R.id.timeTextView); // 获取当前日期 SimpleDateFormat sdf = new SimpleDateFormat("yyyy-MM-dd"); String currentDate = sdf.format(new Date()); // 设置当前日期到日期文本视图 dateTextView.setText(currentDate); addButton = findViewById(R.id.addButton); Button studyLogButton = findViewById(R.id.studyLogButton); studyLogButton.setOnClickListener(new View.OnClickListener() { @Override public void onClick(View v) { Intent intent2 = new Intent(stud.this, list.class); startActivity(intent2); } }); Button studyLogButton1 = findViewById(R.id.viewTodoButton); studyLogButton1.setOnClickListener(new View.OnClickListener() { @Override public void onClick(View v) { Intent intent3 = new Intent(stud.this, view.class); startActivity(intent3); } }); Button studyLogButton2 = findViewById(R.id.statisticsButton); studyLogButton2.setOnClickListener(new View.OnClickListener() { @Override public void onClick(View v) { Intent intent4 = new Intent(stud.this, statistics.class); startActivity(intent4); } }); addButton.setOnClickListener(new View.OnClickListener() { @Override public void onClick(View v) { // 在点击时跳转到另一个页面 Intent intent = new Intent(stud.this, todo.class); startActivity(intent); } }); } }
【推荐】国内首个AI IDE,深度理解中文开发场景,立即下载体验Trae
【推荐】编程新体验,更懂你的AI,立即体验豆包MarsCode编程助手
【推荐】抖音旗下AI助手豆包,你的智能百科全书,全免费不限次数
【推荐】轻量又高性能的 SSH 工具 IShell:AI 加持,快人一步
· 全程不用写代码,我用AI程序员写了一个飞机大战
· DeepSeek 开源周回顾「GitHub 热点速览」
· 记一次.NET内存居高不下排查解决与启示
· MongoDB 8.0这个新功能碉堡了,比商业数据库还牛
· .NET10 - 预览版1新功能体验(一)