Search code examples
androidxamarinandroid-layout-direction

Xamarin Android: What is the equivalent code from Java to C#: resource.getConfiguration().getLayoutDirection() == View.LAYOUT_DIRECTION_RTL;


I'm trying to get the layout direction in Xamarin Android from this java code:

resource.getConfiguration().getLayoutDirection() == View.LAYOUT_DIRECTION_RTL;

I tried to make this code:

Android.Util.LayoutDirection.Rtl == Android.Views.LayoutDirection.Rtl;

But it doesn't Work. I get the error: enter image description here

I'm tryin to implement this code in xamarin Android (from shnizlon's answer):

Implementing SearchView as per the material design guidelines


Solution

  • try this

    if (this.Resources.Configuration.LayoutDirection == LayoutDirection.Rtl)