1

我正在 MAUI 中准备示例项目,在我的示例中,我通过将MauiDrawable设置为它的背景属性来更改本机视图 (ContentViewGroup) 的背景。

var selectionBackground = new MauiDrawable(handler.NativeView.Context);
selectionBackground.SetBackground(mauiBrush);
handler.NativeView.Background = selectionBackground;

RightToLeft 方向,运行时设置背景时,内容方向由 RTL 改为 LTR。

在此处输入图像描述

我们尝试了下面的代码来解决这个问题,但没有奏效。

//handler.NativeView.UpdateFlowDirection(view);
 if (parent.FlowDirection == FlowDirection.RightToLeft)
 {
      handler.NativeView.LayoutDirection = Android.Views.LayoutDirection.Rtl;
 }

请分享您的建议,以将所选内容保留在 RTL 中。

谢谢。

4

0 回答 0