Android Super simple auto infinite carousel diagram Loopview
I just need you to pass in the data.
Demo Address Https://github.com/wanghao200906/Android-LoopView
Effect implementation
1. Adding dependent libraries
2. Adding to XML
<
Com.kevin.loopview.AdLoopView
Android:id= "@+id/main_act_adloopview"
Android:layout_width= "Match_parent"
android:layout_height= "540px" >
</Com.kevin.loopview.AdLoopView >
3. Code
private void Initloopview () {
Final Adloopview Mloopview = (adloopview) This.findviewbyid (R.id.main_act_adloopview);
Get test data
Original author data sources placed in asset
String JSON = Localfileutils.getstringformasset (This, "Loopview_date.json");
My data source uses Tojson to turn data into the format required by the Libs library
String json2= Getloopdatajson ();
Loopdata Loopdata = Jsontool.tobean (JSON, loopdata.class); Mloopview.refreshdata (Loopdata); Mloopview.startautoloop (); Mloopview.setonclicklistener (New Baseloopadapter.onitemclicklistener () {@Override public void Onitemclick (P Ageradapter Parent, view view, int position, int realposition) {Toast.maketext ( Loopviewactivity.this, "" + Position, Toast.length_short). Show (); } });} Private String Getloopdatajson () {loopparent mparent = new Loopparent (); list<itemsentity> items = new arraylist<> (); Itemsentity itemsentity = null; itemsentity = new Itemsentity (); Itemsentity.setimgurl ("http://ww1.sinaimg.cn/large/6e0519bejw1eahallpdi5j20u00f0wip.jpg"); Items.Add (itemsentity); itemsentity = new Itemsentity (); Itemsentity.setdesctext ("Just a test note"); Itemsentity.setimgurl ("Http://src.house.sina.com.cn/imp/imp/deal/9e/ca/e/3e072b93e939b71274b1e3ea4cc_p7_wm43, 41_mk7_c800x800.jpg "); Items.Add (itemsentity); itemsentity = new Itemsentity (); Itemsentity.setimgurl ("http://img0.imgtn.bdimg.com/it/u=3688416272,1545833324&fm=21&gp=0.jpg"); Items.Add (itemsentity); itemsentity = new Itemsentity (); Itemsentity.setimgurl ("Http://src.house.sina.com.cn/imp/imp/deal/9e/ca/e/3e072b93e939b71274b1e3ea4cc_p7_wm43, 41_mk7_c800x800.jpg "); Items.Add (itemsentity); Mparent.setitems (items); LOG.I ("TAG", New Gson (). ToJson (mparent)); return new Gson (). ToJson (mparent);}
Basically, if you're not satisfied with the display, you can change the library-dependent stuff.
Source code Address Https://github.com/wanghao200906/Android-LoopView
This article is only for the technical collection and for friends to share some good code
Android Super simple auto infinite carousel diagram Loopview