alt*_*sto 0 android textview universal-image-loader
我有以下TextView布局:
<TextView
android:layout_width="10dp"
android:layout_height="wrap_content"
android:gravity="center_horizontal"
android:drawableTop="@drawable/ic_launcher" >
Run Code Online (Sandbox Code Playgroud)
我在代码中夸大了这个布局,并希望使用Android-Universal-Image-Loader将图像加载到drawableTop中.但是,据我所知,没有办法从TextView获取backgroundTop的ImageView,因此我无法使用AUIL.有没有办法让ImageView为背景,如果没有,我应该如何修改布局,使其具有ImageView但看起来与原始布局相同?
您可以使用listener(ImageLoadingListener).将以下代码放入onLoadingComplete(...)
void onLoadingComplete(String imageUri, View view, Bitmap loadedImage) {
Drawable topImage = new BitmapDrawable(loadedImage);
textView.setCompoundDrawablesWithIntrinsicBounds(null, topImage, null null);
}
Run Code Online (Sandbox Code Playgroud)
| 归档时间: |
|
| 查看次数: |
1818 次 |
| 最近记录: |