android - How to display four images using coverflow as shown in the attach image link? -
i new android , trying develop app should display images located in drawable folder, shown in image:
please provide suggestion on how achieve effect. providing of appropriate link , explaining code highly appreciated...
just download project , import in eclipse , run
and code example:
java code
/**** * class coverflowtestingactivity. */ public class coverflowtestingactivity extends activity { private textview textview; /* * (non-javadoc) * * @see android.app.activity#oncreate(android.os.bundle) */ @override protected void oncreate(final bundle savedinstancestate) { super.oncreate(savedinstancestate); setcontentview(r.layout.main); textview = (textview) findviewbyid(this.getresources() .getidentifier("statustext", "id", "pl.polidea.coverflow")); // note resources below taken using getidentifier allow importing // library library. final coverflow coverflow1 = (coverflow) findviewbyid(this.getresources().getidentifier("coverflow", "id", "pl.polidea.coverflow")); setupcoverflow(coverflow1, false); final coverflow reflectingcoverflow = (coverflow) findviewbyid(this.getresources().getidentifier( "coverflowreflect", "id", "pl.polidea.coverflow")); setupcoverflow(reflectingcoverflow, true); } /** * setup cover flow. * * @param mcoverflow * m cover flow * @param reflect * reflect */ private void setupcoverflow(final coverflow mcoverflow, final boolean reflect) { baseadapter coverimageadapter; if (reflect) { coverimageadapter = new reflectingimageadapter(new resourceimageadapter(this)); } else { coverimageadapter = new resourceimageadapter(this); } mcoverflow.setadapter(coverimageadapter); mcoverflow.setselection(2, true); setuplisteners(mcoverflow); } /** * sets listeners. * * @param mcoverflow * new listeners */ private void setuplisteners(final coverflow mcoverflow) { mcoverflow.setonitemclicklistener(new onitemclicklistener() { @override public void onitemclick(final adapterview< ? > parent, final view view, final int position, final long id) { textview.settext("item clicked! : " + id); } }); mcoverflow.setonitemselectedlistener(new onitemselectedlistener() { @override public void onitemselected(final adapterview< ? > parent, final view view, final int position, final long id) { textview.settext("item selected! : " + id); } @override public void onnothingselected(final adapterview< ? > parent) { textview.settext("nothing clicked!"); } }); } }
xml
<?xml version="1.0" encoding="utf-8"?>
<pl.polidea.coverflow.coverflow xmlns:coverflow="http://schemas.android.com/apk/res/pl.polidea.coverflow" coverflow:imagewidth="100dip" coverflow:imageheight="150dip" coverflow:withreflection="true" coverflow:imagereflectionratio="0.2" coverflow:reflectiongap="2dip" android:id="@+id/coverflowreflect" android:layout_width="fill_parent" android:layout_height="wrap_content" android:layout_margintop="5dip" /> <textview android:text="status" android:layout_width="fill_parent" android:layout_height="wrap_content" android:padding="5dip" android:id="@+id/statustext"></textview>
Comments
Post a Comment