Android布局绕过带文字的图片

标签 android layout

我想实现文本和图像的 android 布局,如左图所示,但是使用 ImageSpan 并在开始时将图像内联到文本中只给我右图上的内容。

有什么解决方案可以漂亮地绕过带文字的大图吗?

|-------------| texttexttexttexttext   |-------------| 
|             | texttexttexttexttext   |             | 
|   image     | texttexttexttexttext   |   image     | 
|             | texttexttexttexttext   |             |
|-------------| texttexttexttexttext   |-------------| texttexttexttexttext
texttexttexttexttexttexttexttexttext    texttexttexttexttexttexttexttexttext
texttexttexttexttexttexttexttexttext    texttexttexttexttexttexttexttexttext
texttexttexttexttexttexttexttexttext    texttexttexttexttexttexttexttexttext
|

最佳答案

可以通过使用 WebView 和编写 HTML 代码来实现。也可以通过使用 Html.fromHtml(String, Html.ImageGetter, Html.TagHandler) 将 HTML 插入到 TextView 中来实现.查看使用 ImageGetter 的示例 here .

关于Android布局绕过带文字的图片,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/4309198/

相关文章:

CSS:没有 <table> 且第一列可变高度的 2 列布局

html - CSS !important 规则不覆盖文本对齐

android - ResourceBundle - 如何将 getBundle 指向 android 的资源

android - 使用 Espresso 运行 UI 测试,如何在 Material Design 芯片布局中引用关闭图标?

android - Google 登录失败 : The Google Play services resources were not found. 检查您的项目配置以确保包含资源

android - 如何通过仅膨胀一次将相同的 View 多次添加到父级

python - 如何在没有进一步依赖的情况下部署以库为源的 Python 应用程序?

韩国的 Android 开发人员?

java - 关闭处理程序,删除回调

java - 使用java布局定义容器最小尺寸