小编sir*_*cac的帖子

使用 spannablestring 在文本左侧附加图像

我想在我的文本视图中,在文本本身之前显示一个图像。我试过了,CompoundDrawable但第二行的文字没有出现在第一行的图像下方。

我需要这样的东西:

var imageSpan = new ImageSpan(this, Resource.Drawable.Icon); //Find your drawable.
var spannableString = new SpannableString(textView.Text); //Set text SpannableString from TextView
spannableString.SetSpan(imageSpan, textView.Text.Length -1, textView.Text.Length, 0); //Add image at end of string
Run Code Online (Sandbox Code Playgroud)

但是图像在开头而不是结尾。

android inline image textview xamarin

3
推荐指数
1
解决办法
3836
查看次数

标签 统计

android ×1

image ×1

inline ×1

textview ×1

xamarin ×1