Hide a field in landscape mode

android, xamarin

Solution

Try something like:

if (getResources().getConfiguration().orientation == Configuration.ORIENTATION_LANDSCAPE) {
  View my_view = findViewById(R.id.your_view);
  my_view.setVisibility(View.GONE);
}

Problem

Have any method to hide a field in landscape mode? Basically, I want: ``` android:visibility="GONE" ``` Just in landscape mode. Is possible? With a simple solution... I tried this: ``` public override void OnConfigurationChanged(Android.Content.Res.Configuration newConfig) { base.OnConfigurationChanged(newConfig); if(newConfig.Orientation == Android.Content.Res.Orientation.Landscape) { // 1 } else { // 2 } } ``` But does not work.

Original source