Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

Universal Image Loader Fade In From Black?

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);
like image 401
Eric Avatar asked Feb 21 '14 17:02

Eric


1 Answers

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" />
like image 122
Dan Luong Avatar answered Oct 15 '22 17:10

Dan Luong