java - Custom ScrollView in andengine -


how can make custom scrollview moves sides. , how find position tapped scrollview in andengine?

thanks in advance.

i wrote small shapescrollcontainer.java class work in progress functional , welcome use,

https://skydrive.live.com/redir?resid=eb5e1e510a150d4d!105

it allows user scroll within container area, contents add shapescrollcontainer automatically moved accordingly. if content moved outside of bounds of shapescrollcontainer, set content item visibility false, (as described later can fade out content approaches these bounds).

i have included full java doc explanations each method. extends rectangle , implements iscrolldetectorlistener, iclickdetectorlistener interfaces. add scene shape,

shapescrollcontainer scrollablearea = new shapescrollcontainer(x, y, width, height, new ishapescrollcontainertouchlistener() {      @override     public void oncontentclicked(shape pshape) {         // todo auto-generated method stub      }  }); mscene.registertoucharea(scrollablearea); mscene.attachchild(scrollablearea); 

the oncontentclicked interface method called if item added shapescrollcontainer gets clicked user. pshape argument pointer shape clicked. shapescrollcontainer moves contents not camera other sprites have not added container appear unaffected.

you call shapescrollcontainer.add() method add sprites, animated/tiled sprites, rectangles e.t.c. example, changeabletext,

final changeabletext mmessage = new changeabletext(x, y, mfont, "scroll me", horizontalalign.left, 14); mmessage.setvisible(true); mmessage.setzindex(10); mmessage.setblendfunction(gl10.gl_src_alpha, gl10.gl_one_minus_src_alpha); mscene.attachchild(mmessage);  scrollablearea.add(mmessage); 

once have added shapescrollcontainer has variety of methods tailor needs,

//whether want allow user scroll vertical/horizontal scrollablearea.setscrollabledirections(false, true); //only allow user scroll in direction available content //(no more content in direction - user prevented scrolling) scrollablearea.setscrolllock(true); //by how on last content in direction user allowed scroll (% of height/width) scrollablearea.setalphapadding(10.0f, 0); //allow shapescrollcontainer increase alpha of contents , distance starts inside //the shapescrollcontainer itself. (fades content approaches edges due user scrolling) scrollablearea.setscrolllockpadding(50.0f,0.0f); //whether scroll bars visible, (horizontal/vertical) scrollablearea.setscrollbarvisibitlity(true,true) //... //a lot more methods refine scrollablearea appearence , behaviour - see java doc 

hope of use.


Comments

Popular posts from this blog

Change php variable from jquery value using ajax (same page) -

Pull out data related to my apps from Android Play Store and iOS App Store -

How can I fetch data from a web server in an android application? -