Universal Image Loader Fade In From Black?
Asked Answered
W

1

6

I am using Universal Image Loader to "lazy load" my images from the web. Is it possible to use the fade in animation but fade in "from black" instead of "from white"? My app has a black background and I'd like it to smoothly fade it as opposed to "flash" in that the current effect looks like.

Here is the code that is working that fades from white

  DisplayImageOptions options;
            options = new DisplayImageOptions.Builder()
            .showImageOnLoading(R.drawable.no_poster)
            .showImageForEmptyUri(R.drawable.no_poster)
            .showImageOnFail(R.drawable.no_poster)
            .displayer(new FadeInBitmapDisplayer(500))
            .cacheInMemory(true)
            .cacheOnDisc(true)
            .build();
            ImageView myPosterView = (ImageView)findViewById(R.id.movieposterlarge);
            imageLoader.displayImage(movie_poster, myPosterView,options);
Waksman answered 21/2, 2014 at 17:30 Comment(0)
M
4

This seems to work for me.

    options = new DisplayImageOptions.Builder()
            .showImageOnLoading(android.R.color.black)
            .showImageForEmptyUri(android.R.color.black)

Note, you also have to set the background of whatever view you are using to black also:

<GridView
    android:id="@+id/gridview"
    android:layout_width="match_parent"
    android:layout_height="match_parent"
    android:layout_margin="0dp"
    android:background="@color/Black"
    android:horizontalSpacing="0dp"
    android:numColumns="1"
    android:padding="0dp"
    android:stretchMode="columnWidth"
    android:verticalSpacing="10dp" />
Monomer answered 10/8, 2014 at 18:11 Comment(0)

© 2022 - 2024 — McMap. All rights reserved.