TextView的DrawableRight图片
来源:互联网 发布:ubuntu安装deb软件命令 编辑:程序博客网 时间:2024/05/21 07:02
1、在xml中为TextVIew添加Drawable
<TextView android:id="@+id/textview" android:layout_width="match_parent" android:layout_height="wrap_content" android:background="@color/white" android:drawableRight="@drawable/myicon" android:padding="10dp" android:text="文本内容" android:textColor="@color/black" android:textSize="20dp"> </TextView>
2、在代码中设置Drawable
setCompoundDrawables(Drawable left,Drawable top,Drawable right,Drawable bottom)
Drawable可以通过 Drawable drawable=getResources().getDrawable(R.drawable.myicon);得到
但是API提示,setCompoundDrawables() 调用的时候,Drawable对象必须调用setBounds(int left, int top, int right, int bottom)方法
Drawable drawable = getResources().getDrawable(R.drawable.myicon); drawable.setBounds(0, 0, drawable.getMinimumWidth(), drawable.getMinimumHeight()); textview.setCompoundDrawables(null, null, drawable, null);
0 0
- TextView的DrawableRight图片
- 代码中修改TextView的DrawableRight图片
- 在代码中修改TextView的DrawableRight图片
- 在代码中修改TextView的DrawableRight图片
- 在代码中修改TextView的DrawableRight图片
- 在代码中修改TextView的DrawableRight图片
- 在代码中修改TextView的DrawableRight图片
- 在代码中修改TextView的DrawableRight图片
- 在代码中修改TextView的DrawableRight图片
- 在代码中修改TextView的DrawableRight图片
- 在代码中修改TextView的DrawableRight图片
- TextView 解决drawableRight图片总是空隙很大
- Android中动态设置TextView的drawableLeft和drawableRight的时候图片未出现
- 设置Textview的Drawableleft、Drawableright 等图片与文字间距、位置和大小的方法
- TextView中设置drawableLeft、drawableRight时设置图片的大小方法
- 在代码中设置Textview的drawableRight
- TextView 代码实现drawableRight
- android关于TextView的drawableLeft,drawableTop,drawableRight,drawableRight的drawable大小及位置问题
- 解决svn pritine text not exist问题
- 小京东V5.X短信宝插件开发
- css3动画的三种写法:
- 【AJAX】基本原理
- 程序计时
- TextView的DrawableRight图片
- 浏览器中实现3D全景浏览
- 使用Filter为请求方法添加跨域支持
- 【Android】JavaCV and OpenCV
- 引用类型String
- java
- 性能测试工具---Traceview
- 挺进
- 使用RecyclerView notifyItemChanged()出现图片闪烁问题解决