Android - 如何更改选项卡中文本和图像的默认位置?
我们可以更改选项卡中文本和图像的位置吗?
因为我使用的图像尺寸稍大,并且隐藏了选项卡的标题。
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 技术交流群。
绑定邮箱获取回复消息
由于您还没有绑定你的真实邮箱,如果其他用户或者作者回复了您的评论,将不能在第一时间通知您!
发布评论
评论(2)
要更改选项卡栏中的图像和文本视图,您需要编写自定义选项卡栏。
检查此链接以获取自定义标签栏
For Changing Image and Text View in Tab Bar you need to write Custom Tab Bar.
Check this link for Custom Tab Bar
您所要做的就是通过
在主类中调用
tabHost.getTabWidget().getChildAt(i).getLayoutParams().height
Eg. 来增加选项 卡的高度它扩展了 TabActivity,在 TabHost 中实现此代码:如果高度不足以容纳您的自定义图像,请增加高度。
快乐编码!
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 :
Increase the height if it's not big enough for your custom image.
Happy coding!