搜索
热搜: 活动 交友 discuz
查看: 3002|回复: 0
打印 上一主题 下一主题

代码方式为TextView控件设置drawableLeft图标,并设置间距

[复制链接]

160

主题

165

帖子

814

积分

管理员

Rank: 9Rank: 9Rank: 9

积分
814
跳转到指定楼层
楼主
发表于 2017-1-13 10:08:03 | 只看该作者 回帖奖励 |倒序浏览 |阅读模式
  1. //在左侧添加图片  
  2.     Drawable drawable= getResources().getDrawable(R.drawable.gray_circle);  
  3.     drawable.setBounds(0, 0, drawable.getMinimumWidth(), drawable.getMinimumHeight());  
  4.       
  5.     textView.setCompoundDrawables(drawable, null, null, null);  

  6.     textView.setCompoundDrawablePadding(4);//设置图片和text之间的间距   
复制代码


回复

使用道具 举报

您需要登录后才可以回帖 登录 | 立即注册

本版积分规则

Archiver|手机版|安卓论坛  

GMT+8, 2024-5-15 12:04 , Processed in 0.076945 second(s), 35 queries .

Powered by Discuz! X3.2

© 2001-2013 Design S!|ƽ̶

快速回复 返回顶部 返回列表