locked
To AppCompat or Not AppCompat? RRS feed

  • Question

  • User10329 posted

    I am a newbie when it comes to AppCompat on Android. My understanding is that it is a slightly different API that you can use to get current Android features on older Android versions.

    1. So my first question is when should I use AppCompat and when should I not?

    FYI: If you create a new Xamarin.Forms app from the XS/VS template, it seems to create an AppCompat Android app.

    My next issue comes with custom renderers. I was confused why my Frame did not show a border so I thought I would just customize the renderer and draw the border myself. I quickly realized that there are 2 built-in FrameRenderers, one for AppCompat and one for not AppCompat.

    1. My next question is should I always extend the AppCompat built-in renderer if my app is AppCompat or can I extend the normal built-in renderer?

    Looking at the source code of each built-in FrameRenderer, I noticed why my Frame did not have border. The AppCompat FrameRenderer does NOT support borders. The normal FrameRenderer DOES support borders. That's weird. So if I make a custom renderer and extend the normal FrameRenderer but do NOT customize anything, this forces my Frame to use the normal FrameRenderer which supports borders and my border now appears.

    Anybody have any thoughts on this weirdness?

    Friday, August 19, 2016 3:30 AM

Answers

  • User25759 posted

    With AppCompat I always recommend it especially for Xamarin.Forms apps: * Gives consistent theme and style across all versions of Android * Turns app into fragment first approach (performance boost) * Material swipeable tabs, which are very nice * CardView is what is used for the frame so that is nice to have (see evolve app) * Libraries and framework are already setup in the project and come in the NuGets

    For non-Xamarin.Forms projects it depends: * If you want to reach pre-Lollipop then it is a must * Sometimes you have to bring in the libraries anyways since a lot of things are built for app compat * Will increase app size a small bit as it is a big library.

    That is my 2cents

    • Marked as answer by Anonymous Thursday, June 3, 2021 12:00 AM
    Thursday, September 22, 2016 9:06 PM

All replies

  • User774 posted

    Very good question. I'm surprised there are no answers

    Thursday, September 22, 2016 6:38 PM
  • User25759 posted

    With AppCompat I always recommend it especially for Xamarin.Forms apps: * Gives consistent theme and style across all versions of Android * Turns app into fragment first approach (performance boost) * Material swipeable tabs, which are very nice * CardView is what is used for the frame so that is nice to have (see evolve app) * Libraries and framework are already setup in the project and come in the NuGets

    For non-Xamarin.Forms projects it depends: * If you want to reach pre-Lollipop then it is a must * Sometimes you have to bring in the libraries anyways since a lot of things are built for app compat * Will increase app size a small bit as it is a big library.

    That is my 2cents

    • Marked as answer by Anonymous Thursday, June 3, 2021 12:00 AM
    Thursday, September 22, 2016 9:06 PM
  • User10329 posted

    Can we get this discussion going again? I think AppCompat is REQUIRED for Xamarin.Forms for certain features. Like the new Page.TitleView. Scanning the XF source, it seems only the AppCompat renderer deals with TitleView, but not the other one.

    I have always avoided AppCompat because I am ok targeting later API versions and do not need to be backwards compatible. But am I correct that AppCompat is becoming required for Xamarin.Forms

    Monday, November 19, 2018 5:12 AM