android - SurfaceView horizontal scrolling -


i'm writing application create graph , draw on surfaceview. graph needs able update live want surfaceview scrollable horizontally user can see data. possible?

you need place custom view inside horizontal scroll view separeate class. when create instace of custom graph view tell size according width of graph overriding onmeasure method:

@override protected void onmeasure(int widthmeasurespec, int heightmeasurespec) {          super.onmeasure(widthmeasurespec, heightmeasurespec);            this.setmeasureddimension(graphwidth, graphheight); }  graphwidth = barlenghtinpixels * barcount + extraspaceinpixels; 

you can place customview in xml layout using custom tag <com.myapplication.graphview...> or use myscrollview.addview(mycustomview) , add horizontalscrollview, before call setcontentview(mylayout).


Comments

Popular posts from this blog

linux - Using a Cron Job to check if my mod_wsgi / apache server is running and restart -

actionscript 3 - TweenLite does not work with object -

jQuery Ajax Render Fragments OR Whole Page -