Android设置图片和文本相对位置
2015-05-18 16:08
375 查看
在代码中设置文本与图片的相对位置时,可以用setCompoundDrawables(left, top, right, bottom)方法。
方法非常简单首先需要使用setBounds(int left, int top, int right, int bottom)给图片设置边界,然后再使用
setCompoundDrawables(left, top, right, bottom)方法设置图片的位置。
方法非常简单首先需要使用setBounds(int left, int top, int right, int bottom)给图片设置边界,然后再使用
setCompoundDrawables(left, top, right, bottom)方法设置图片的位置。
Drawable drawable = getResources().getDrawable(R.drawable.back_arrow); drawable.setBounds(0, 0, drawable.getMinimumWidth(), drawable.getMinimumHeight()); goBackTextView.setCompoundDrawables(null, null, null, drawable);
相关文章推荐
- Android setCompoundDrawablesWithIntrinsicBounds手工设置文本与图片相对位置说明
- 安卓设置文本与图片相对位置
- Android setCompoundDrawablesWithIntrinsicBounds手工设置文本与图片相对位置说明
- Android setCompoundDrawablesWithIntrinsicBounds手工设置文本与图片相对位置说明
- Android广告图片轮播控件,支持无限循环和5种主题,可以灵活设置轮播样式、时间、位置、图片加载框架等!
- ios Button 设置图片和文本的位置
- Android代码中动态设置图片的大小(自动缩放),位置
- Android广告图片轮播控件,支持无限循环和5种主题,可以灵活设置轮播样式、时间、位置、图片加载框架等!
- Android--Android教程]EditText设置/隐藏光标位置、选中文本和获取/清除焦点
- 设置Android中RadioButton的图片大小和位置
- Android-代码设置图片大小及位置
- Android点滴---TextView,RadioButton 设置 HTML文本,加载网络图片
- Android代码中设置图片,文本自定义颜色,Linearlayout等控件设置背景
- Android RadioButton背景图片和文字的相对位置
- [置顶] 关于图片与文字在一行显示时,文本的垂直方向位置的设置
- TextField 设置图片的文本位置
- Android开发中如何改变RadioButton背景图片和文字的相对位置(转)
- [Android教程]EditText设置/隐藏光标位置、选中文本和获取/清除焦点
- android中getCompoundDrawables()方法,设置文本框中图片的位置
- Android广告图片轮播控件,支持无限循环和5种主题,可以灵活设置轮播样式、时间、位置、图片加载框架等!