An open source project welcome, share to everyone
<relativelayout xmlns:android= "http://schemas.android.com/apk/res/android" xmlns:coverflow= "http// Schemas.android.com/apk/res-auto "xmlns:tools=" Http://schemas.android.com/tools "android:layout_width=" Match_ Parent "android:layout_height=" match_parent "android:background=" @android: Color/darker_gray "tools:context=" It.mo Ondroid.carousellayoutdemo.CoverFlowActivity "> < It.moondroid.coverflow.components.ui.containers.FeatureCoverFlow android:id= "@+id/coverflow" Android:layout_ Width= "Match_parent" android:layout_height= "match_parent" coverflow:coverheight= "@dimen/cover_height" Coverflow:coverwidth= "@dimen/cover_width" coverflow:maxscalefactor= "1.5" coverflow:reflectiongap= "0px" coverflow:rotationthreshold= "0.5" coverflow:scalingthreshold= "0.5" coverflow:spacing= "0.6"/> <T Extswitcher android:id= "@+id/title" android:layout_width= "Match_parent" Android:layout_height= "Wrap_content" android:paddingbottom= "16DP" android:layout_alignparentbottom= "true" Android:layout_ Centervertical= "true"/></relativelayout>
Package It.moondroid.coverflowdemo;import Android.app.activity;import Android.os.bundle;import Android.view.layoutinflater;import Android.view.menu;import Android.view.menuitem;import Android.view.View;import Android.view.animation.animation;import Android.view.animation.animationutils;import Android.widget.AdapterView; Import Android.widget.textswitcher;import Android.widget.textview;import Android.widget.toast;import Android.widget.viewswitcher;import Java.util.arraylist;import It.moondroid.coverflow.components.ui.containers.featurecoverflow;public class Coverflowactivity extends Activity { Private Featurecoverflow Mcoverflow; Private Coverflowadapter Madapter; Private arraylist<gameentity> Mdata = new arraylist<> (0); Private Textswitcher Mtitle; @Override protected void OnCreate (Bundle savedinstancestate) {super.oncreate (savedinstancestate); Setcontentview (R.layout.activity_coverflow); Mdata.add (New Gameentity (R.drawable.image_1, R.String.title1)); Mdata.add (New Gameentity (r.drawable.image_2, r.string.title2)); Mdata.add (New Gameentity (R.drawable.image_3, r.string.title3)); Mdata.add (New Gameentity (R.drawable.image_4, r.string.title4)); Mtitle = (textswitcher) Findviewbyid (r.id.title); Mtitle.setfactory (New Viewswitcher.viewfactory () {@Override public View Makeview () { Layoutinflater inflater = Layoutinflater.from (coverflowactivity.this); TextView TextView = (TextView) inflater.inflate (r.layout.item_title, NULL); return textView; } }); Animation in = Animationutils.loadanimation (this, r.anim.slide_in_top); Animation out = Animationutils.loadanimation (this, r.anim.slide_out_bottom); Mtitle.setinanimation (in); Mtitle.setoutanimation (out); Madapter = new Coverflowadapter (this); Madapter.setdata (Mdata); Mcoverflow = (featurecoverflow) Findviewbyid (R.Id.coverflow); Mcoverflow.setadapter (Madapter); Mcoverflow.setonitemclicklistener (New Adapterview.onitemclicklistener () {@Override public void onIt Emclick (adapterview<?> Parent, view view, int position, long id) {Toast.maketext (coverflowactivity.t His, getresources (). getString (Mdata.get (position). Titleresid), Toast.length_ Short). Show (); } }); Mcoverflow.setonscrollpositionlistener (New Featurecoverflow.onscrollpositionlistener () {@Override P ublic void onscrolledtoposition (int position) {Mtitle.settext (Getresources (). getString (Mdata.get (position) . Titleresid)); } @Override public void onscrolling () {Mtitle.settext (""); } }); } @Override Public boolean Oncreateoptionsmenu (Menu menu) {//Inflate the menu, this adds items to the Actio N Bar If IT is present. Getmenuinflater (). Inflate (r.menu.menu_coverflow_activity, menu); return true; } @Override public boolean onoptionsitemselected (MenuItem Item) {//Handle Action Bar item clicks here. The action bar would//automatically handle clicks on the Home/up button, so long/As you specify a parent Activity in Androidmanifest.xml. int id = item.getitemid (); Noinspection simplifiableifstatement if (id = = r.id.action_settings) {return true; } return super.onoptionsitemselected (item); }}
Code Download:
http://download.csdn.net/detail/jingwen3699/8937523
Copyright NOTICE: This article for Bo Master original article, without Bo Master permission not reproduced.
More Gorgeous slides