Android Question Scale whole Activity

ilan

Expert
Licensed User
Longtime User
B4X:
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.


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)
 
Upvote 0

LucaMs

Expert
Licensed User
Longtime User
I think i will put it in a panel and then scale the panel and change his position.

Sounds simpler :)

this is sure :)

As you know, you can use Erel's code to scale a panel, not only Activities:
B4X:
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

Expert
Licensed User
Longtime User
this is sure :)

As you know, you can use Erel's code to scale a panel, not only Activities:
B4X:
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

this is what i said o_O {:D}
 
Upvote 0
Top