真的只是一个小问题,我想将当前年份放在我的应用程序的页脚中。每个页脚都是一个 TextView,可以在菜单屏幕等上看到。有没有办法在其中动态插入年份?
干杯, 劳伦斯
最佳答案
你可以这样做:
Calendar calendar = Calendar.getInstance();
int year = calendar.get(Calendar.YEAR);
TextView footer = findViewById(R.id.footer);
footer.setText("" + year);
关于android - 将当前年份插入 TextView,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/2215069/