I’m playing around with 2D drawing within a custom view. So far I’ve got it drawing what I want(Point data from an array) but I want the drawing to scale and be able to extend it beyond the screen(such that 1 second of data per screen width). The method I’m using for drawing relies on getHeight and getWidth to set the bounds of the information in the screen. I’m using the screens width to extend the canvas in onDraw to several screen widths in size(depending on the time of the data).
I’ve been unable to find a way of drawing that will allow me to scroll horizontally, and support a zoom like function… is there an easy way of doing this? ScrollView doesn’t do Horizontally, and when I go beyond the screen it just get’s cut off. My layout so far is
<HorizontalScrollView
android:layout_width="fill_parent"
android:layout_height="fill_parent"
android:layout_weight="1"
>
<LinearLayout
android:layout_width="fill_parent"
android:layout_height="wrap_content"
android:orientation="horizontal"
>
<view class="com.box.sand.SandGraph$GraphView"
android:id="@+id/graph"
android:layout_width="fill_parent"
android:layout_height="fill_parent"
/>
</LinearLayout>
</HorizontalScrollView>
But when I put this in, the onDraw of my view never get’s called.
This may solve your problem.
Although I doubt that it has a zoom function, you should be able to implement the rest of what you’re asking for using this.
EDIT:
The hierarchy would go as follows: