I've wrapped an android java View into a library and want to set this library View as the ScrollView Panel.
This is my new library:
You can find the source for the wrapped class (pl.polidea.view.ZoomView) here: http://code.google.com/p/android-zoom-view/source/browse/src/pl/polidea/view/ZoomView.java.
The wrapped class extends the FrameLayout class, as FrameLayout extends ViewGroup and a B4A Panel is a ViewGroup i was hoping that anywhere a B4A Panel is used, my ZoomPanel could be used as a direct replacement.
My aim is to add pinch-zoom and drag to a TableView.
I suspect it won't work - the ScrollView will receive all touch events and my ZoomPanel will not.
But i wanted to test it anyway and thought it's be easiest to pass a ScrollView to a library method where the ScrollView first (and only) child View is replaced with my ZoomPanel, so added this method to my library:
An exception is raised - the ScrollView already has a child View, my method seems to be trying to insert the ZoomPanel at index 0 instead of replacing the existing Panel with the ZoomPanel.
So i've been looking at the Panel source in core.jar using jd-gui and cannot see where the ScrollView's one and only child View is created.
A B4A ScrollView wraps the MyScrollView class.
MyScrollView extends ScrollView.
No where do i see where the ScrollView (or MyScrollView) child is created.
All examples on the web that show programmatically creating a ScrollView show the ScrollView's only child View also being created programmatically.
This does not create a ScrollView with a child View, it creates a ScrollView with no child (i think):
So i'm asking can i replace the Panel in a ScrollView with my ZoomPanel and if so, what java syntax would i use.
Thanks.
Martin.
This is my new library:
B4X:
public class ZoomPanel extends PanelWrapper {
/**
* ZoomPanel is an enhanced Panel that supports pinch-zoom and drag.
*/
public static void LIBRARY_DOC(){}
@Override
public void Initialize(BA pBA, String EventName) {
super.Initialize(pBA, EventName);
}
@Hide
@Override
public void innerInitialize(BA pBA, String pEventName, boolean pKeepOldObject) {
if(!pKeepOldObject){
setObject(new pl.polidea.view.ZoomView(pBA.context));
// TODO add listener?
}
super.innerInitialize(pBA, pEventName, true);
}
}
You can find the source for the wrapped class (pl.polidea.view.ZoomView) here: http://code.google.com/p/android-zoom-view/source/browse/src/pl/polidea/view/ZoomView.java.
The wrapped class extends the FrameLayout class, as FrameLayout extends ViewGroup and a B4A Panel is a ViewGroup i was hoping that anywhere a B4A Panel is used, my ZoomPanel could be used as a direct replacement.
My aim is to add pinch-zoom and drag to a TableView.
I suspect it won't work - the ScrollView will receive all touch events and my ZoomPanel will not.
But i wanted to test it anyway and thought it's be easiest to pass a ScrollView to a library method where the ScrollView first (and only) child View is replaced with my ZoomPanel, so added this method to my library:
B4X:
public void ReplacePanelWithZoomPanel(ScrollView ScrollView1){
ScrollView1.addView(getObject(), 0);
}
An exception is raised - the ScrollView already has a child View, my method seems to be trying to insert the ZoomPanel at index 0 instead of replacing the existing Panel with the ZoomPanel.
So i've been looking at the Panel source in core.jar using jd-gui and cannot see where the ScrollView's one and only child View is created.
A B4A ScrollView wraps the MyScrollView class.
MyScrollView extends ScrollView.
No where do i see where the ScrollView (or MyScrollView) child is created.
All examples on the web that show programmatically creating a ScrollView show the ScrollView's only child View also being created programmatically.
This does not create a ScrollView with a child View, it creates a ScrollView with no child (i think):
B4X:
ScrollView myScrollView = new ScrollView(aContext);
So i'm asking can i replace the Panel in a ScrollView with my ZoomPanel and if so, what java syntax would i use.
Thanks.
Martin.