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

iphone - Using nested NSDictionary with Picker -

javascript - Iterate over array and calculate average values of array-parts -

php - accessing mysql using different server to which db connection data is located -