textview的图片设置

2019-03-20  本文已影响0人  ben大福

setCompoundDrawablesWithIntrinsicBounds(Drawable left, Drawable top, Drawable right, Drawable bottom)

api原文为:

Sets the Drawables (if any) to appear to the left of, above, to the right of, and below the text. Use null if you do not want a Drawable there. The Drawables’ bounds will be set to their intrinsic bounds.

设置drawable到textview的上下左右位置中去,图片大小就是drawable的intrinsic大小

setCompoundDrawables(Drawable left, Drawable top, Drawable right, Drawable bottom)

api原文为:

Sets the Drawables (if any) to appear to the left of, above, to the right of, and below the text. Use null if you do not want a Drawable there. The Drawables must already have had setBounds(Rect) called.

设置的drawable必须要先设置Bounds

setCompoundDrawablePadding(int pad)

api原味为:

Sets the size of the padding between the compound drawables and the text.

设置drawable和text的间距pandding

上一篇下一篇

猜你喜欢

热点阅读