Skip to content

[Android] Child view arranges LTR ignoring Page FlowDirection RTL when label is measured at runtime in custom layout #33345

@RiyashameedM

Description

@RiyashameedM

Description

Custom StackLayout (deriving from StackLayout with a custom LayoutManager), a first label (view1) is added initially and a second label (view2 with label2) is added on tap. The ContentPage FlowDirection is set to RightToLeft. After adding the second label, if label2 is measured explicitly inside LayoutMeasure, the first label (view1) is arranged/displayed in LeftToRight, ignoring the page-level RTL. If the measurement of label2 is skipped and view2.DesiredSize is used instead, the UI arranges correctly in RTL. but I must measure label2 directly for my implementation.

Image

Steps to Reproduce

1.Run the sample.
2.tap on CustomLabel.

Expected output

After tapping to add the second label, both labels (view1 and view2) should respect RightToLeft layout:
Label text aligned and arranged according to RTL.
No switch to LeftToRight for view2.

Observed behavior
CustomLabel(label2) is arranged according to LTR.

Link to public reproduction project repository

SimpleSample.zip

Version with bug

10.0.0

Is this a regression from previous behavior?

Not sure, did not test other versions

Last version that worked well

10.0.0

Affected platforms

Android

Affected platform versions

Windows 11

Did you find any workaround?

Do not measure label2 directly; instead, measure the container (view2) and use view2.DesiredSize for arrangement.

Relevant log output

Metadata

Metadata

Assignees

No one assigned

    Labels

    Type

    No type

    Projects

    No projects

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions