使用复合drawables在TextView中设置实际的文本填充 [英] Set actual text padding in TextView with compound drawables

查看:99
本文介绍了使用复合drawables在TextView中设置实际的文本填充的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我有一个ListView填充了ArrayAdapter.对于项目,我仅使用单个TextView布局.我希望某些行设置复合可绘制对象.

I have a ListView populated with an ArrayAdapter. For items I use just a single TextView layout. I want some of the rows to have compound drawables set.

问题:是否可以为TextView中包含的实际文本设置填充,以使复合可绘制对象也不会获得填充?其他解决方案是锁定文本的宽度.我需要在布局中添加ImageViews吗?

Question: is there a way to set padding for the actual text that is contained in TextView so that the compound drawables don't get the padding too? Other solution would be to lock the width of text. Do I need to add ImageViews to my layout?

谢谢.

推荐答案

我将其发布为答案,以便遇到该帖子的人找到答案.

没有直接的方法来只为文本设置填充,但是您可以为整个TextView设置填充,并为drawable设置填充

There's no direct way to set a padding only to text, but you can set a positive padding to the whole TextView and set a negative padding for the drawable.

这篇关于使用复合drawables在TextView中设置实际的文本填充的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

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