Android - 如何更改选项卡中文本和图像的默认位置?

发布于 2024-12-04 19:30:20 字数 60 浏览 1 评论 0原文

我们可以更改选项卡中文本和图像的位置吗?

因为我使用的图像尺寸稍大,并且隐藏了选项卡的标题。

Can we change the place of text and image in tabs?

Because images which i have used are slightly big in dimensions and hiding the title of my tabs.

如果你对这篇内容有疑问,欢迎到本站社区发帖提问 参与讨论,获取更多帮助,或者扫码二维码加入 Web 技术交流群。

扫码二维码加入Web技术交流群

发布评论

需要 登录 才能够评论, 你可以免费 注册 一个本站的账号。

评论(2

夏见 2024-12-11 19:30:20

要更改选项卡栏中的图像和文本视图,您需要编写自定义选项卡栏。
检查此链接以获取自定义标签栏

For Changing Image and Text View in Tab Bar you need to write Custom Tab Bar.
Check this link for Custom Tab Bar

Oo萌小芽oO 2024-12-11 19:30:20

您所要做的就是通过

在主类中调用 tabHost.getTabWidget().getChildAt(i).getLayoutParams().height Eg. 来增加选项 卡的高度它扩展了 TabActivity,在 TabHost 中实现此代码:

TabHost tabHost;


       for (int i = 0; i < getTabWidget().getTabCount(); i++ ) {

        tabHost.getTabWidget().getChildAt(i).getLayoutParams().height = 100;
    }

如果高度不足以容纳您的自定义图像,请增加高度。
快乐编码!

All you have to do is increase the height of your tabs by calling tabHost.getTabWidget().getChildAt(i).getLayoutParams().height

Eg. In your main class which extends TabActivity, implement this code in your into your TabHost :

TabHost tabHost;


       for (int i = 0; i < getTabWidget().getTabCount(); i++ ) {

        tabHost.getTabWidget().getChildAt(i).getLayoutParams().height = 100;
    }

Increase the height if it's not big enough for your custom image.
Happy coding!

~没有更多了~
我们使用 Cookies 和其他技术来定制您的体验包括您的登录状态等。通过阅读我们的 隐私政策 了解更多相关信息。 单击 接受 或继续使用网站,即表示您同意使用 Cookies 和您的相关数据。
原文