How to set background image to a LinearLayout using Android-Universal-Image-Loader ? #594
2014-10-08 16:01
531 查看
You can do it by 2 ways:
use
Implement
And then you can pass this
But
https://github.com/nostra13/Android-Universal-Image-Loader/issues/594
use
loadImage(...)and set layout background in listener (
ImageLoadingListener.onLoadingComplete(..., Bitmap loadedImage, ...))
Implement
ImageAwarewhich will wrap
LinearLayout(like
ImageViewAware). At this moment you can find
ViewAwareclass in repository which does the main work for it. You should just extend it like this:
public class BgViewAware extends ViewAware { public BgViewAware(View view) { super(view); } public BgViewAware(View view, boolean checkActualViewSize) { super(view, checkActualViewSize); } @Override protected void setImageDrawableInto(Drawable drawable, View view) { view.setBackgroundDrawable(drawable); } @Override protected void setImageBitmapInto(Bitmap bitmap, View view) { view.setBackgroundDrawable(new BitmapDrawable(view.getResources(), bitmap)); } }
And then you can pass this
BgViewAware(
new BgViewAware(linearLayout)) into
displayImage(...)method.
But
ViewAwareclass isn't released yet. It will be available in UIL 1.9.2.
https://github.com/nostra13/Android-Universal-Image-Loader/issues/594
相关文章推荐
- How to set background image of a component in GWTEXT
- UILabel How to set background image
- How to make android app’s background image repeat.
- UILabel How to set background image
- How to tile a background image in Android
- How can I set the background of UITableView (the tableview style is "Grouped") to use an image?
- Android代码优化----PullToRefresh+universal-image-loader实现从网络获取数据并刷新
- UniversalAndroidImageLoader出现异常:ImageLoader: Unable to resolve host "https": No address associated with host
- how to set UITableViewCell background image
- 如何解决Android出现的异常“java.lang.NoSuchMethodError: android.widget.LinearLayout.setBackground”?
- UILabel How to set background image
- How to preview local image using JS in IE6, IE7, FF3.*
- Android - How to have a tiled background
- How to set timeout for user when login using zend_auth?
- Using Alpha Channel to Blend Image on a Background Smoothly
- [iOS/Android开发之WebService]How to write a webservices using php with json format
- How-to create a Calculator Using Google Android: Part II
- how to set android build type
- How to create and use SDCard image for Android emulator
- How to store an image file to SQliteDB in android