Android setCompoundDrawablesWithIntrinsicBounds手工设置文本与图片相对位置说明
2015-01-23 16:24
465 查看
手工设置文本与图片相对位置时,常用到如下方法:
setCompoundDrawables(left, top, right, bottom);
setCompoundDrawablesWithIntrinsicBounds(left, top, right, bottom)
意思是设置Drawable显示在text的左、上、右、下位置。
(Textview、Button都可以)
但是两者有些区别:
setCompoundDrawables(left, top, right, bottom);
setCompoundDrawablesWithIntrinsicBounds(left, top, right, bottom)
意思是设置Drawable显示在text的左、上、右、下位置。
(Textview、Button都可以)
但是两者有些区别:
setCompoundDrawables 画的drawable的宽高是按drawable.setBound()设置的宽高,所以才有The Drawables must already have had setBounds(Rect) called.意思是说使用之前必须使用Drawable.setBounds设置Drawable的长宽。 而setCompoundDrawablesWithIntrinsicBounds是画的drawable的宽高是按drawable固定的宽高,即通过getIntrinsicWidth()与getIntrinsicHeight()获得,所以才有The Drawables' bounds will be set to their intrinsic bounds.这句话之说! |
相关文章推荐
- Android setCompoundDrawablesWithIntrinsicBounds手工设置文本与图片相对位置说明
- Android setCompoundDrawablesWithIntrinsicBounds手工设置文本与图片相对位置说明
- 安卓设置文本与图片相对位置
- Android设置图片和文本相对位置
- TextField 设置图片的文本位置
- UIEdgeInsetsMake设置UIButton的图片、文字的相对位置
- NSMutableAttributedString设置图片与文本的垂直位置
- ios Button 设置图片和文本的位置
- [置顶] 关于图片与文字在一行显示时,文本的垂直方向位置的设置
- C#:TextBox换行、设置光标位置、随文本滚动
- Silverlight图片相对路径的设置
- Flex中通过设置labelPlacement属性设置RadioButton控件文本标签排列位置的例子
- C#:TextBox换行、设置光标位置、随文本滚动
- 关于JPanel设置背景图片的Bug说明
- C#:TextBox换行、设置光标位置、随文本滚动
- 用Word2007批量设置图片位置
- 关于Silverlight资源文件(如:图片)的放置位置及其引用(相对路径)
- jQuery获取当前鼠标相对位置坐标和点击图片跳转上一张或下一张功能
- 用Word2007批量设置图片位置
- 操作Word对象----在指定位置插入图片并设置大小(原)