如何删除在Android的TextView的顶部和底部的空间 [英] How to remove the top and bottom space on textview of Android

查看:425
本文介绍了如何删除在Android的TextView的顶部和底部的空间的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

当我有以下 XML 来的布局的文件,我可以看到下面的图片。如果你看到它,你可能会意识到的TextView 的顶部和底部的空间。

When I include the below XML to layout file, I can see the below image. If you see it, you could realize that the TextView has top and bottom space.

<TextView
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:text="E1"
android:background="#ff00ff00"/>

我要删除的空间。如何去除呢?它叫什么? 如果有人有线索..请让我知道。先谢谢了。

I wish to remove the space. How to remove it? What is it called? If anyone has clue.. please let me know. Thanks in advance.

推荐答案

尝试安卓includeFontPadding =假来看看是否有帮助。根据我的经验,这将有助于一点点,但没有办法降低的TextView尺寸精确的像素完美的文字大小。

Try android:includeFontPadding="false" to see if it helps. In my experience that will help a little bit, but there's no way of reducing the TextView dimensions to the exact pixel-perfect text size.

唯一的选择,其可以或可以不给出更好的结果,是欺骗一个位和硬线的尺寸以匹配文字的大小,如24sp而不是WRAP_CONTENT的高度。

The only alternative, which may or may not give better results, is to cheat a bit and hard-wire the dimensions to match the text size, e.g. "24sp" instead of "wrap_content" for the height.

这篇关于如何删除在Android的TextView的顶部和底部的空间的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

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