我必须创建一个显示当前日期的应用程序。在向前滑动日期应递增,并且向后滑动日期应递减。如何在android中增加和减少日期?
我成功地向前滑动显示当前日期和增量。但我不会在单一活动中如何减少向后滑动。
这是我的代码。
TAB活动
SimpleDateFormat sdf = new SimpleDateFormat("dd/MM/yyyy");
Calendar c = Calendar.getInstance();
c.add(Calendar.DAY_OF_MONTH,position);
String dte = sdf.format(c.getTime()).toString();
TextView textView2 = getView().findViewById(R.id.textView2);
textView2.setText(dte);
}
}
如果我要建立这个应用程序,那么我会用任何Android的GitHub日期选择器库。或者利用这个[采集器,阅读谷歌开发人员文档的采摘](https://developer.android.com/guide/topics/ui/controls/pickers.html) –