你好,我想在我的应用程序的一些 Activity 中将相同的文本放置在应用程序的标题下(在布局的顶部),而不影响其他对象布局。
- 类似工具栏的东西,但只有文本。
- 像这样 but not a button
但我希望此文本仅在某些内容为 true
时出现,而不是在所有 activities
上出现。
关于我该怎么做的任何建议?我该如何实现?
附言我是安卓新手。
最佳答案
您可以在 toolbar
对象上使用 setSubtitle()
方法。对于自定义,您可以使用 setSubtitleTextAppearance (Context context, int resId)
但是文档说-
A title and subtitle. The title should be a signpost for the Toolbar's current position in the navigation hierarchy and the content contained there. The subtitle, if present should indicate any extended information about the current content. If an app uses a logo image it should strongly consider omitting a title and subtitle.
关于android - 应用程序标题下有关某些 Activity 的文字,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/36268564/