Android的标签不带图标不带、图标、标签、Android

2023-09-07 16:38:33 作者:18.帅的有个性

我设置我的标签如下:

 spec = tabHost.newTabSpec("tab1").setIndicator("Tab 1").setContent(intent);
    tabHost.addTab(spec);

而现在我有没有图标,只有一个标题标签,但它只是叶子与底部的标题的图标大小的空白 - 我想在XML调整layout_height,但随后的文字是走了因为它呈现的分界点之下。

And now I have a tab that has no icon, only a title, but it just leaves an icon-sized blank space with the Title at the bottom - I tried adjusting the layout_height in the xml, but then the text is gone because it is rendered below the cutoff point.

我如何更改标签的大小,并没有图标都显示的标题?

How can I change the size of a tab, and have the title displayed without an icon?

推荐答案

答案很简单:你不能。默认的Andr​​oid标签永远离开形象某些空白。但是你可以创建自己的选项卡中的默认选项卡,以弥补该限购。这里是一个非常好的教程创建自定义选项卡。

The answer is simple: You can't. The default android tab will always leave some blank space for the image. But you can create your own tabs to compensate that "restriction" in the default tab. Here is a very good tutorial to create custom tabs.

http://joshclemm.com/blog/?p=136

祝你好运,Arkde

Good luck, Arkde