1

I am developing a native mobile app for all platforms. I have created my own theme content page. Then after deployment on android when I make phone landscape it did not respond. what's the reason here.

Here is my base content page.

   public abstract class BaseContentPage : ContentPage
{
    public readonly BaseViewModel BaseViewModel;

    protected bool _isNavigated = false;

    public BaseContentPage(BaseViewModel baseViewModel)
    {
        BaseViewModel = baseViewModel;
    }

    public abstract void Navigate(SelectedItemChangedEventArgs e);
    protected abstract override void OnAppearing();
    protected override void OnDisappearing()
    {
        _isNavigated = true;
    }

    public BaseContentPage()
    {

    }
}

here Xaml

        <views:BaseContentPage
xmlns:views="clr-namespace:DipsDemoXaml.Views"

            xmlns="http://xamarin.com/schemas/2014/forms"
            xmlns:x="http://schemas.microsoft.com/winfx/2009/xaml"    
            xmlns:Resource="clr-namespace:DipsDemoXaml.Resources"

            x:Class="DipsDemoXaml.Views.WardListPage" Title="{x:Static Resource:AppResources.WardListPageTitle}">
    <StackLayout BackgroundColor="{StaticResource DefaultBackgroundColor}" Orientation="Vertical" x:Name="s1">

I even try this also in code behind constructor I call size changed and create a method called Wardpagesizechanged.

        public WardListPage(WardListPageViewModel wardListViewModel) : base(wardListViewModel)
    {
        InitializeComponent();
        this.SizeChanged += wardpagesizechanged;


    }

Wardpagesizechanged method

      private void wardpagesizechanged(object sender, EventArgs e)
    {
       if(this.Width> this.Height)
        {
            s1.Orientation = StackOrientation.Horizontal;
        }
        else
        {
            s1.Orientation = StackOrientation.Vertical;
        }
    }

what is the problem here, I am clueless

Chamila Maddumage
  • 3,304
  • 2
  • 32
  • 43
ish1104
  • 401
  • 4
  • 19
  • Hi, blind guess or more a stupid question back, but could it be that you turned off screen rotation features within your app? For example, if I create a completely new project in Visual Studio the MainActivity.cs within the Droid project has the ConfigurationChanges = ConfigChanges.ScreenSize | ConfigChanges.Orientation) set which according to this http://guides.peruzal.com/xamarin-android/application-fundamentals/handling-config-changes/ prevents the Activity to be created again, which will block it from being created in updated rotation state. – Hardcore_Graverobber Mar 13 '19 at 13:24
  • you need refresh your page to show differences – Batuhan Mar 28 '19 at 13:27
  • i did that but it doesn't work – ish1104 Mar 29 '19 at 06:38

0 Answers0