我想用复合位图创建一个 TextView,我知道 android 支持用复合可绘制对象创建 TextView,但我想在在线下载图像时复合位图
注意:我不想让 LinearLayout 保存 imageview 和 textview
最佳答案
以下是如何在 XML 代码中执行此操作。这会在顶部添加一个 Drawable
。您可以将其更改为左侧、右侧或底部:
<TextView
android:id="@+id/id"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:drawableTop="@drawable/yourdrawable"
/>
编辑
抱歉,完全误解了您的问题。您可以通过创建 BitmapDrawable 然后将其用作复合 Drawable 在代码中执行此操作。更多信息请点击:http://developer.android.com/reference/android/graphics/drawable/BitmapDrawable.html
关于安卓 : How to make TextView with compound bitmap,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/9651428/