正确的TextView填充 [英] Correct TextView Padding
问题描述
我编程方式填充的TextView
。在 layout_width
的TextView
被设置为 WRAP_CONTENT
。
I am populating a TextView
programmatically. The layout_width
of TextView
is set to wrap_content
.
WRAP_CONTENT
当文本适合一行工作正常,但两行以上,文本视图宽度似乎符合父母的宽度,使填充不尊重在第二行。
wrap_content
works fine when the text fits into one line, but for two or more lines, the text view width seems to match the parents width, so that padding is not respected in the second line.
例如,这是怎么显示一些示例文本。
For example, this is how it displays some sample text.
的通知回应中的第三行不尊重填充,而是这个词如何父的宽度相匹配。
Notice how the word 'responding' in the third line does not respect padding and instead matches the parent's width.
如何纠正呢?
推荐答案
尽量填充设置为其父布局。这将是工作,如果我理解正确。
Try to set padding to its parent layout. That will be work, if I understand correctly.
这篇关于正确的TextView填充的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!