带时间戳的 android:label
用于开发和出于调试目的,我希望图标下的标签包含一个时间戳,以提示此特定实例的构建时间。
负责此标签的条目是主 Activity 下的 android:label="@string/app_name"
。
问题在于 @string/app_name
是硬编码的。
是否有可能完成如上所述的构建时间戳标签?
我不介意在 onCreate() 中设置它(即在第一次运行后会更改),只要它确实更改了图标下的标签(不在标题栏中)。
For development & debug purposes, I would like to have the label under the icon contain a timestamp that hints when this particular instance was built.
The entry that's responsible for this label is android:label="@string/app_name"
under the main activity.
The problem is that @string/app_name
is hard-coded.
Is is possible at all to accomplish a build timestamped label as I described above?
I don't mind setting it in onCreate() (i.e. will change after the 1st run), as long as it indeed changes the label under the icon (not in the title bar).
如果你对这篇内容有疑问,欢迎到本站社区发帖提问 参与讨论,获取更多帮助,或者扫码二维码加入 Web 技术交流群。
绑定邮箱获取回复消息
由于您还没有绑定你的真实邮箱,如果其他用户或者作者回复了您的评论,将不能在第一时间通知您!
发布评论
评论(1)
您应该做的是在构建过程中包含一个步骤,该步骤始终修改
app_name
xml 值以包含时间戳。这可以通过 Ant 使用 XML Mainpulation Task 来替换 xml 值。What you should do is include a step in your build process that always modifies the
app_name
xml value to include the time stamp. This can be done with Ant using an XML Mainpulation Task to replace xml value.