【发布时间】:2019-10-21 15:07:49
【问题描述】:
我正在尝试在资源 string.xml 中的字符串 (my_string_name) 中添加可绘制对象 (ic_myimage)
<resources>
<string name="my_string_name">Here is my image: @drawable/ic_myimage It looks great</string>
</resources>
这可能吗?我希望将带有其余字符串的图像显示在我的 TextView 中。 (代码如下)
<TextView
android:id="@+id/myTextView"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:text="@string/my_string_name"
app:layout_constraintBottom_toBottomOf="parent"
app:layout_constraintLeft_toLeftOf="parent"
app:layout_constraintRight_toRightOf="parent"
app:layout_constraintTop_toTopOf="parent" />
注意:我尝试了在另一篇文章中找到的以下方法,但没有成功
<string name="my_string_name">Here is my image: [img src=ic_myimage/] It looks great</string>
我正在使用 Android Studio 和 Kotlin。
【问题讨论】:
标签: android android-drawable android-resources