Forum Xamarin.Android
We are excited to announce that the Xamarin Forums are moving to the new Microsoft Q&A experience. Q&A is the home for technical questions and answers at across all products at Microsoft now including Xamarin!

We encourage you to head over to Microsoft Q&A for .NET for posting new questions and get involved today.

Collapsible toolbar

Alex_DarbyAlex_Darby USMember
edited November 2016 in Xamarin.Android

Hello Xamarin community,

I am trying to implement the collapsible toolbar on a xamarin forms app running on a android 7.0 phone but I am not having any success.

I have checked all the relevant articles and how-to on the internet via Xamarin forums, Stack Overflow and Github and I have done the following to get it implemented :

  • Created a new android xaml layout file with all the relevant layout objects needed.
  • Updated the xamarin forms MainActivity.cs for setting the content view to the layout above.
  • Updated the xamarin forms MainActivity.cs for setting the SupportActionBar() using the layout above.

I am calling the above code in the MainActivity.cs OnCreate() method after the base.OnCreate() and the following is called after :

        global::Xamarin.Forms.Forms.Init(this, bundle);
        LoadApplication(new App());

My Xamarin forms page is just a content page with a stack layout and a ListView in the stack layout.

Is there something I am missing to enable the tool-bar to collapse?

A lot of the code examples on the net are using vanilla android apps so there could be something that needs to be changed to enable the toolbar to collapse on a xamarin forms app.

Answers

  • RobocopRobocop SEMember

    So.. whats not working?
    Or did you get it to work?

  • kalyanipwrkalyanipwr Member ✭✭

    @Alex_Darby said:
    Hello Xamarin community,

    I am trying to implement the collapsible toolbar on a xamarin forms app running on a android 7.0 phone but I am not having any success.

    I have checked all the relevant articles and how-to on the internet via Xamarin forums, Stack Overflow and Github and I have done the following to get it implemented :

    • Created a new android xaml layout file with all the relevant layout objects needed.
    • Updated the xamarin forms MainActivity.cs for setting the content view to the layout above.
    • Updated the xamarin forms MainActivity.cs for setting the SupportActionBar() using the layout above.

    I am calling the above code in the MainActivity.cs OnCreate() method after the base.OnCreate() and the following is called after :

            global::Xamarin.Forms.Forms.Init(this, bundle);
            LoadApplication(new App());
    

    My Xamarin forms page is just a content page with a stack layout and a ListView in the stack layout.

    Is there something I am missing to enable the tool-bar to collapse?

    A lot of the code examples on the net are using vanilla android apps so there could be something that needs to be changed to enable the toolbar to collapse on a xamarin forms app.

    Hello @Alex_Darby did you achieve this functionality of collapsible toolbar? i am trying hard for it. Can you help me please?

Sign In or Register to comment.