Android setCompoundDrawablesWithIntrinsicBounds手工设置文本与图片相对位置说明
来源:互联网 发布:淘宝系会员和积分制度 编辑:程序博客网 时间:2024/04/29 10:45
手工设置文本与图片相对位置时,常用到如下方法:
setCompoundDrawables(left, top, right, bottom);
setCompoundDrawablesWithIntrinsicBounds(left, top, right, bottom)
意思是设置Drawable显示在text的左、上、右、下位置。
(Textview、Button都可以)
但是两者有些区别:
setCompoundDrawables(left, top, right, bottom);
setCompoundDrawablesWith
意思是设置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.这句话之说!
而setCompoundDrawablesWith
0 0
- Android setCompoundDrawablesWithIntrinsicBounds手工设置文本与图片相对位置说明
- Android setCompoundDrawablesWithIntrinsicBounds手工设置文本与图片相对位置说明
- 安卓设置文本与图片相对位置
- android 设置图片小妙招 setCompoundDrawables与setCompoundDrawablesWithIntrinsicBounds
- NSMutableAttributedString设置图片与文本的垂直位置
- 设置控件与控件的相对位置
- android后台设置控件相对位置
- TextField 设置图片的文本位置
- Android-04 setCompoundDrawables与setCompoundDrawablesWithIntrinsicBounds的区别
- 图片放大缩小并且文字与图片相对位置不变
- UIEdgeInsetsMake设置UIButton的图片、文字的相对位置
- 相对布局设置位置
- 设置div相对位置
- 关于图片与文字在一行显示时,文本的垂直方向位置的设置
- ANDROID相对布局说明
- Android设置图片和文本相对位置
- 9.17表格,背景,文本与图片位置关系
- 代码设置RelativeLayout相对位置设置
- 鼠标问题导致笔记本开机点击桌面和任务栏无反应
- Android TextView中展示含有html标签的文字
- 体育行业网络营销外包实例分析
- matlab编译运行c文件
- C语言编程(练习2:函数 )
- Android setCompoundDrawablesWithIntrinsicBounds手工设置文本与图片相对位置说明
- QTableWidget详解(样式、右键菜单、表头塌陷、多选等)
- POJ 3762 The Bonus Salary! 最小费用最大流
- 深入理解java内存模型
- OpenCV,常用图像增强算法的实现
- 面向对象编程的六大原则
- free命令中的buffers和cached
- 原子性操作atomic_t
- 在Android4.2中实现bluetooth A2dp Sink(一)——移植Android5.0蓝牙协议栈