ilan Expert Licensed User Longtime User May 10, 2016 #1 hi is it possible to scale the whole activity (zoom in/out)? http://stackoverflow.com/questions/14806618/how-to-zoom-whole-activity-on-multi-touch
hi is it possible to scale the whole activity (zoom in/out)? http://stackoverflow.com/questions/14806618/how-to-zoom-whole-activity-on-multi-touch
somed3v3loper Well-Known Member Licensed User Longtime User May 10, 2016 #2 Code: Copy Activity.Height=50%y Activity.Width=50%x ? Well , not zooming Upvote 0
Erel B4X founder Staff member Licensed User Longtime User May 11, 2016 #3 Code: Copy Sub Activity_Click Dim jo As JavaObject = Activity Dim factor As Float = 2 jo.RunMethod("setScaleX", Array(factor)) jo.RunMethod("setScaleY", Array(factor)) End Sub For a better solution you need to use ScrollView2D. Upvote 0
Code: Copy Sub Activity_Click Dim jo As JavaObject = Activity Dim factor As Float = 2 jo.RunMethod("setScaleX", Array(factor)) jo.RunMethod("setScaleY", Array(factor)) End Sub For a better solution you need to use ScrollView2D.
ilan Expert Licensed User Longtime User May 11, 2016 #4 Erel said: Code: Copy Sub Activity_Click Dim jo As JavaObject = Activity Dim factor As Float = 2 jo.RunMethod("setScaleX", Array(factor)) jo.RunMethod("setScaleY", Array(factor)) End Sub For a better solution you need to use ScrollView2D. Click to expand... great it is working, is it also possible to move it arround? when i tried in Activity_Touch to set the activity left/top to x/y i get this error: ** Service (starter) Create **~i:** Service (starter) Start ** ** Activity (main) Create, isFirst = true ** ** Activity (main) Resume ** Error occurred on line: 51 (Main) java.lang.ClassCastException: android.widget.FrameLayout$LayoutParams cannot be cast to anywheresoftware.b4a.BALayout$LayoutParams at anywheresoftware.b4a.objects.ViewWrapper.setLeft(ViewWrapper.java:170) at java.lang.reflect.Method.invoke(Native Method) at java.lang.reflect.Method.invoke(Method.java:372) at anywheresoftware.b4a.shell.Shell.runMethod(Shell.java:702) at anywheresoftware.b4a.shell.Shell.raiseEventImpl(Shell.java:336) at anywheresoftware.b4a.shell.Shell.raiseEvent(Shell.java:246) at java.lang.reflect.Method.invoke(Native Method) at java.lang.reflect.Method.invoke(Method.java:372) at anywheresoftware.b4a.ShellBA.raiseEvent2(ShellBA.java:134) at anywheresoftware.b4a.BA$1.run(BA.java:293) at android.os.Handler.handleCallback(Handler.java:739) at android.os.Handler.dispatchMessage(Handler.java:95) at android.os.Looper.loop(Looper.java:135) at android.app.ActivityThread.main(ActivityThread.java:5221) at java.lang.reflect.Method.invoke(Native Method) at java.lang.reflect.Method.invoke(Method.java:372) at com.android.internal.os.ZygoteInit$MethodAndArgsCaller.run(ZygoteInit.java:899) at com.android.internal.os.ZygoteInit.main(ZygoteInit.java:694) Click to expand... Upvote 0
Erel said: Code: Copy Sub Activity_Click Dim jo As JavaObject = Activity Dim factor As Float = 2 jo.RunMethod("setScaleX", Array(factor)) jo.RunMethod("setScaleY", Array(factor)) End Sub For a better solution you need to use ScrollView2D. Click to expand... great it is working, is it also possible to move it arround? when i tried in Activity_Touch to set the activity left/top to x/y i get this error: ** Service (starter) Create **~i:** Service (starter) Start ** ** Activity (main) Create, isFirst = true ** ** Activity (main) Resume ** Error occurred on line: 51 (Main) java.lang.ClassCastException: android.widget.FrameLayout$LayoutParams cannot be cast to anywheresoftware.b4a.BALayout$LayoutParams at anywheresoftware.b4a.objects.ViewWrapper.setLeft(ViewWrapper.java:170) at java.lang.reflect.Method.invoke(Native Method) at java.lang.reflect.Method.invoke(Method.java:372) at anywheresoftware.b4a.shell.Shell.runMethod(Shell.java:702) at anywheresoftware.b4a.shell.Shell.raiseEventImpl(Shell.java:336) at anywheresoftware.b4a.shell.Shell.raiseEvent(Shell.java:246) at java.lang.reflect.Method.invoke(Native Method) at java.lang.reflect.Method.invoke(Method.java:372) at anywheresoftware.b4a.ShellBA.raiseEvent2(ShellBA.java:134) at anywheresoftware.b4a.BA$1.run(BA.java:293) at android.os.Handler.handleCallback(Handler.java:739) at android.os.Handler.dispatchMessage(Handler.java:95) at android.os.Looper.loop(Looper.java:135) at android.app.ActivityThread.main(ActivityThread.java:5221) at java.lang.reflect.Method.invoke(Native Method) at java.lang.reflect.Method.invoke(Method.java:372) at com.android.internal.os.ZygoteInit$MethodAndArgsCaller.run(ZygoteInit.java:899) at com.android.internal.os.ZygoteInit.main(ZygoteInit.java:694) Click to expand...
LucaMs Expert Licensed User Longtime User May 11, 2016 #5 I don't know if there is a workaround, but Activity should not expose: Left, Top, SetLayout, given they also raise the same error. Upvote 0
I don't know if there is a workaround, but Activity should not expose: Left, Top, SetLayout, given they also raise the same error.
ilan Expert Licensed User Longtime User May 11, 2016 #6 I think i will put it in a panel and then scale the panel and change his position. Sounds simpler Upvote 0
LucaMs Expert Licensed User Longtime User May 11, 2016 #7 ilan said: I think i will put it in a panel and then scale the panel and change his position. Sounds simpler Click to expand... this is sure As you know, you can use Erel's code to scale a panel, not only Activities: Code: Copy Sub ScalePanel(pnl As Panel, factor As Float) Dim jo As JavaObject = pnl jo.RunMethod("setScaleX", Array(factor)) jo.RunMethod("setScaleY", Array(factor)) End Sub Upvote 0
ilan said: I think i will put it in a panel and then scale the panel and change his position. Sounds simpler Click to expand... this is sure As you know, you can use Erel's code to scale a panel, not only Activities: Code: Copy Sub ScalePanel(pnl As Panel, factor As Float) Dim jo As JavaObject = pnl jo.RunMethod("setScaleX", Array(factor)) jo.RunMethod("setScaleY", Array(factor)) End Sub
ilan Expert Licensed User Longtime User May 11, 2016 #8 LucaMs said: this is sure As you know, you can use Erel's code to scale a panel, not only Activities: Code: Copy Sub ScalePanel(pnl As Panel, factor As Float) Dim jo As JavaObject = pnl jo.RunMethod("setScaleX", Array(factor)) jo.RunMethod("setScaleY", Array(factor)) End Sub Click to expand... this is what i said {} Upvote 0
LucaMs said: this is sure As you know, you can use Erel's code to scale a panel, not only Activities: Code: Copy Sub ScalePanel(pnl As Panel, factor As Float) Dim jo As JavaObject = pnl jo.RunMethod("setScaleX", Array(factor)) jo.RunMethod("setScaleY", Array(factor)) End Sub Click to expand... this is what i said {}
LucaMs Expert Licensed User Longtime User May 11, 2016 #9 ilan said: this is what i said Click to expand... Not exactly: you could also use a different method to scale the panel, for example the Scale module Upvote 0
ilan said: this is what i said Click to expand... Not exactly: you could also use a different method to scale the panel, for example the Scale module