Android标签:不要在下方显示文字 [英] Android Tabs: don't display the text underneath

查看:53
本文介绍了Android标签:不要在下方显示文字的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

也许我没有足够仔细地阅读它,但是标签布局教程未指定如何显示不带图标或下方没有文本的标签.这些都有可能吗?如果是这样,我该怎么办?

Maybe I'm not reading it carefully enough, but the Tab Layout tutorial doesn't specify how to display a tab without the icon or without the text underneath. Are either of these possible? If so, how do I do it?

推荐答案

您尝试过吗?

对于没有图标的标签

spec = tabHost.newTabSpec("artists").setIndicator("Artists",null)
                  .setContent(intent);

对于没有文本的标签

spec = tabHost.newTabSpec("artists").setIndicator("",
                      res.getDrawable(R.drawable.ic_tab_artists))
                  .setContent(intent);

当然,这些只是实现它们的一种简便方法.对于选项卡上更复杂的视图,您可能需要一个自定义视图,并使用 setIndicator(视图视图)方法来获得所需的外观.

Of course, these are just lee way of doing them. For more complicated view on tabs, you may want to have a customized view and use setIndicator (View view) method to get your desired look.

这篇关于Android标签:不要在下方显示文字的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆