Android Question Problem with layout with B4a v. 9.00

Lello1964

Well-Known Member
Licensed User
Longtime User
i have a problem with attached layout with b4a v. 9.00

it's loaded with most normal resolution screen

but

if i load this layout with Huawai P10pro - 1080 x 1920 SCALE 3 (480DPI)

or Xiaomi Redmi Note 7 - 1080 x 2009 SCALE 2.75 (440DPI)

some problem with Pixel 2 XL API 28 using virtual device with AVD manager


B4X:
   Dim tmpPanel As Panel
   tmpPanel.Initialize("")
   tmpPanel.LoadLayout("Cell_EstrattoConto")

i have this error :

java.lang.RuntimeException: java.lang.IllegalArgumentException: Cannot set 'scaleX' to Float.NaN
at anywheresoftware.b4a.keywords.LayoutBuilder.loadLayout(LayoutBuilder.java:170)
at anywheresoftware.b4a.objects.PanelWrapper.LoadLayout(PanelWrapper.java:134)
at java.lang.reflect.Method.invoke(Native Method)
at anywheresoftware.b4a.shell.Shell.runMethod(Shell.java:732)
at anywheresoftware.b4a.shell.Shell.raiseEventImpl(Shell.java:351)
at anywheresoftware.b4a.shell.Shell.raiseEvent(Shell.java:255)
at java.lang.reflect.Method.invoke(Native Method)
at anywheresoftware.b4a.ShellBA.raiseEvent2(ShellBA.java:144)
at jet.document.estrattoconto.afterFirstLayout(estrattoconto.java:104)
at jet.document.estrattoconto.access$000(estrattoconto.java:17)
at jet.document.estrattoconto$WaitForLayout.run(estrattoconto.java:82)
at android.os.Handler.handleCallback(Handler.java:891)
at android.os.Handler.dispatchMessage(Handler.java:102)
at android.os.Looper.loop(Looper.java:207)
at android.app.ActivityThread.main(ActivityThread.java:7539)
at java.lang.reflect.Method.invoke(Native Method)
at com.android.internal.os.RuntimeInit$MethodAndArgsCaller.run(RuntimeInit.java:524)
at com.android.internal.os.ZygoteInit.main(ZygoteInit.java:958)
Caused by: java.lang.IllegalArgumentException: Cannot set 'scaleX' to Float.NaN
at android.view.View.sanitizeFloatPropertyValue(View.java:15568)
at android.view.View.sanitizeFloatPropertyValue(View.java:15542)
at android.view.View.setScaleX(View.java:14931)
at android.animation.PropertyValuesHolder.nCallFloatMethod(Native Method)
at android.animation.PropertyValuesHolder.access$400(PropertyValuesHolder.java:38)
at android.animation.PropertyValuesHolder$FloatPropertyValuesHolder.setAnimatedValue(PropertyValuesHolder.java:1387)
at android.animation.ObjectAnimator.animateValue(ObjectAnimator.java:990)
at android.animation.ValueAnimator.setCurrentFraction(ValueAnimator.java:674)
at android.animation.ValueAnimator.setCurrentPlayTime(ValueAnimator.java:637)
at android.animation.ValueAnimator.start(ValueAnimator.java:1069)
at android.animation.ValueAnimator.start(ValueAnimator.java:1088)
at android.animation.ObjectAnimator.start(ObjectAnimator.java:852)
at android.animation.ValueAnimator.startWithoutPulsing(ValueAnimator.java:1081)
at android.animation.AnimatorSet.handleAnimationEvents(AnimatorSet.java:1142)
at android.animation.AnimatorSet.startAnimation(AnimatorSet.java:1227)
at android.animation.AnimatorSet.start(AnimatorSet.java:729)
at android.animation.AnimatorSet.start(AnimatorSet.java:684)
at anywheresoftware.b4a.objects.ViewWrapper.AnimateFrom(ViewWrapper.java:461)
at anywheresoftware.b4a.keywords.LayoutBuilder.animateLayout(LayoutBuilder.java:191)
at anywheresoftware.b4a.keywords.LayoutBuilder.loadLayout(LayoutBuilder.java:165)
... 17 more
 

Attachments

  • cell_estrattoconto.bal
    8 KB · Views: 238
Last edited:

Erel

B4X founder
Staff member
Licensed User
Longtime User
I don't know whether this is the reason for this error, however you should never load a layout to a zero sized panel.
Change your code to:
B4X:
Dim tmpPanel As Panel
   tmpPanel.Initialize("")
   tmpPanel.SetLayoutAnimated(0, 0, 0, 300dip, 300dip)
   tmpPanel.LoadLayout("Cell_EstrattoConto")
 
Upvote 0
Top