Search code examples
javaandroidhuawei-mobile-serviceshuawei-developersharmonyos

How to dynamically change size of dialog box with respect to animating component set inside it in Harmony App Development?


I am creating Harmony Application.
Here I am creating a common dialog and setting a custom component and using component.createAnimatorProperty() to create animator property and staring it.
When I start animation only the component animates with specific properties but the dialog box(dialog window) is not changing its size according to the inside component changing size. How to dynamically change its size with inside component size.

// created a custom component for setting it
CommonDialog commonDialog = new CommonDialog(getContext);
commonDialog.setContentCustomComponent(customComponent);
commonDialog.show();
Thread.sleep(1000);
AnimatorProperty animatorProperty = customComponent.createAnimatorProperty().setDuration(100)
                .scaleX(1.04f).scaleY(1.04f).scaleXFrom(1).scaleYFrom(1);
animatorProperty.start();

Solution

  • As per the current HMOS platform support, the animation can be set to only to the customComponent or titleComponent object that are set within the dialog. In other words, it is possible to set the animation only to the component objects. Setting the animation for the dialog, to see the dialog bounds animate - this is currently not supported. Let's stay tuned for the future HMOS update regarding this.