简体   繁体   English

如何在Android TabActivity中增加文本和图像之间的距离?

[英]How do I increase the distance between the text and the image in an Android TabActivity?

I have a Tabactivity with several Tabs and the text is overlaying the images in the tabs. 我有几个标签的Tabactivity,文本覆盖了标签中的图像。 How do I increase the distance between the image and the tabs ? 如何增加图像和标签之间的距离?

The best way would be to use your own drawable with any paddings (10dp). 最好的方法是对任何填充(10dp)使用您自己的可绘制对象。 You can use images for this, or you can create your tabs' backgrounds via xml's, say inside a root element: 您可以为此使用图像,也可以通过xml创建标签的背景,例如在根元素中:

<layer_list>
    <item android:top="10dp" android:left="10dp" android:right="10dp" android:bottom="10dp">
        <shape android:shape="rectangle">
        [..]
        </shape>
    </item>
    [..]
</layer_list>

我通过在图像底部添加空白的透明空间(现在已被文本覆盖)解决了这个问题,但这并不重要。

声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM