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);

            }
        });

    }
}
复制代码

 

posted @   new菜鸟  阅读(5)  评论(0编辑  收藏  举报
相关博文:
阅读排行:
· 全程不用写代码,我用AI程序员写了一个飞机大战
· DeepSeek 开源周回顾「GitHub 热点速览」
· 记一次.NET内存居高不下排查解决与启示
· MongoDB 8.0这个新功能碉堡了,比商业数据库还牛
· .NET10 - 预览版1新功能体验(一)
点击右上角即可分享
微信分享提示