Custom format for relative time span(相对时间跨度的自定义格式)
问题描述
我正在尝试创建一种自定义格式来显示经过的时间.
I'm trying to create an custom format to display the elapsed time.
现在我正在使用:
这会返回像这样的相对时间跨度:
This returns relative time spans like this:
- 1 分钟前
- 36 分钟前
- 4 小时前
...
我想要做的是显示这个,像这样:
What I'm trying to do is display this, like this:
- 1m
- 36m
- 4 小时
...
我知道 DateUtils 有 FORMAT_ABBREV_ALL 标志,但这并没有像我想要的那样缩写字符串......
I know DateUtils has FORMAT_ABBREV_ALL flag, but this doesn't abbreviate the string like I want to...
我怎样才能为此创建一些自定义的东西?
How can I create something custom for this ?
推荐答案
我已经在我的 twitter 模块中完成了这个
i have done this in my twitter module
这篇关于相对时间跨度的自定义格式的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持编程学习网!