问题描述
我有这5个按钮,在我的计划:周一,周二,周三,周四和周五,这是我的菜单屏幕上。我现在想的是,当我的程序启动和我的菜单屏幕打开时,该按钮包含当天的日子+的日期。
I have these 5 buttons in my program: Monday, Tuesday, Wednesday, Thursday and Friday, which are on my menu screen. What I want now is that when my program starts and my menu screen opens, the buttons contain the days + the dates of the day.
例如,今天我们是第四个月的(幸福星球大战一天!)并且按钮应该是这样的:
For example, today we're the fourth of may (happy Star Wars day!) and the buttons should be like this:
周一04/30周二05/01周三05/02周四05/03周五05/04
Monday 04/30Tuesday 05/01Wednesday 05/02Thursday 05/03Friday 05/04
但是,当我打开菜单画面下周一就应该是这样的:周一05/07周二05/08周三05/09周四05/10周五05/11
But when I open the menu screen next monday it should be like this:Monday 05/07Tuesday 05/08Wednesday 05/09Thursday 05/10Friday 05/11
我怎样才能做到这一点?
How can I do this?
推荐答案
使用java的Calendar类,有一个答案在这里,可以帮助你设计一个解决方案How来得到当前一周和一个月的第一天?
Use the java Calendar class, there is an answer here that could help you devise a solution How to get the first day of the current week and month?
这篇关于获取本周的Android中的日期的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持!