Textvie实现左边图片和换行文字左对齐的方法
作者:信仰love 时间:2022-10-30 23:15:16
实现的效果图:
代码实现:
tv = (TextView) findViewById(R.id.tv);
String a = "有2年没这样想想真佩服你们现在,2年没这样想想真,2年没这样想想真佩佩服,2年没这样想想真佩服";
SpannableString spanText = new SpannableString("图"+a);
Drawable d = getResources().getDrawable(R.mipmap.gen_zan_p);
// 左上右下 控制图片大小
d.setBounds(0, 0, 30, 30);
// 替换0,1的字符
spanText.setSpan(new ImageSpan(d), 0, 1, Spannable.SPAN_INCLUSIVE_EXCLUSIVE);
tv.append("\n");
tv.append(spanText);
来源:http://blog.csdn.net/u014074418/article/details/65446408
标签:Textvie,左边图片,换行,文字,左对齐
![](/images/zang.png)
![](/images/jiucuo.png)
猜你喜欢
关于Java虚拟机HotSpot
2022-10-28 18:36:01
![](https://img.aspxhome.com/file/2023/4/83144_0s.png)
Java引用传递和值传递栈内存与堆内存的指向操作
2021-05-30 04:43:37
![](https://img.aspxhome.com/file/2023/9/79229_0s.jpg)
Java运行时数据区概述详解
2023-10-08 07:00:10
![](https://img.aspxhome.com/file/2023/0/69130_0s.png)
Kotlin使用TransitionDrawable实现颜色渐变效果流程讲解
2023-03-28 06:54:08
![](https://img.aspxhome.com/file/2023/3/120113_0s.png)
C#中CheckedListBox控件的用法实例
2021-08-05 06:03:29
![](https://img.aspxhome.com/file/2023/5/94575_0s.png)
Java三种方法将List转换为Map的实例
2023-08-21 09:02:41
Android 如何获取手机总内存和可用内存等信息
2023-07-27 13:11:42
Android AlertDialog的几种用法详解
2023-12-02 18:15:50
![](https://img.aspxhome.com/file/2023/2/137692_0s.png)
C# 使用SpecFlow创建BDD测试用例的示例代码
2021-05-25 21:35:00
![](https://img.aspxhome.com/file/2023/7/100227_0s.png)
Java多线程案例之单例模式懒汉+饿汉+枚举
2021-11-07 05:18:01
![](https://img.aspxhome.com/file/2023/0/77130_0s.png)
Java精品项目瑞吉外卖之员工信息管理篇
2023-07-29 07:43:36
![](https://img.aspxhome.com/file/2023/9/81939_0s.png)
Android 微信6.1 tab栏图标和字体颜色渐变的实现
2023-12-14 22:34:04
![](https://img.aspxhome.com/file/2023/4/114364_0s.gif)
Java泛型<T> T与T的使用方法详解
2021-07-12 10:58:42
C# DataGridView添加新行的2个方法
2023-06-23 05:42:19
hadoop中实现java网络爬虫(示例讲解)
2021-12-22 01:35:20
![](https://img.aspxhome.com/file/2023/2/77092_0s.png)
Android仿UC浏览器左右上下滚动功能
2023-08-27 12:43:19
![](https://img.aspxhome.com/file/2023/9/125539_0s.gif)
SpringBoot整合canal实现数据同步的示例代码
2022-05-07 19:51:24
![](https://img.aspxhome.com/file/2023/1/61661_0s.png)
详解Java设计模式编程中的访问者模式
2023-11-28 01:00:43
![](https://img.aspxhome.com/file/2023/0/58920_0s.jpg)
Winform在DataGridView中显示图片
2023-06-26 21:02:48
Flutter开发中的路由参数处理
2023-06-21 04:27:48
![](https://img.aspxhome.com/file/2023/4/88724_0s.gif)