Friday, April 20, 2012

3D Gallery in Android


Coverflow - 3D gallery

Background explanation
There doesn't seem to be a coverflow widget that is available in Android .Looking at the current set of android widgets there is the Gallery widget which has a lot of nice features such as fling and scrolling support, and also a nice algorithm for centring the images after a fling. There was definitely a lot here that could re-use,so just extend the Gallery widget and override some of the methods in it.I have create CoverflowExample, attached with this article.
How to use
To use the CoverFlow widget you'll first need to create a package and put CoverFlow class class in it. Once you've done this you can then create you're own activity to use the Coverflow widget.
We can Set CoverFlow using ContentView or using xml layout file
CoverFlow coverFlow;
coverFlow = new CoverFlow(this);
setContentView(coverFlow);
<?xml version="1.0" encoding="utf-8"?>

<LinearLayout xmlns:android="http://schemas.android.com/apk/res/android"

    android:orientation="vertical"
    android:layout_width="fill_parent"
    android:layout_height="fill_parent"
    >
<com.example.coverflow.CoverFlow
    android:id="@+id/coverflow"
    android:layout_width="fill_parent"
    android:layout_height="wrap_content"
/>
</LinearLayout>
We can simply apply adapter to CoverFlow class wich extends BaseAdapter
coverFlow.setAdapter(new ImageAdapter(this));
ImageAdapter coverImageAdapter = new ImageAdapter(this);
coverFlow.setAdapter(coverImageAdapter);
coverFlow.setSpacing(-15);
coverFlow.setSelection(8, true);
Please refer to this given link for more information.
Reference Link:-[[http://www.inter-fuser.com/2010/02/android-coverflow-widget-v2.html]]

No comments:

Post a Comment