Do I need AppCompatActivity & v7 support libraries with a minimum sdk of 21?

I'm new to Android and a little confused right now.

After setting up a new project with min sdk 21 (Android 5.0) in android studio, by default my main_activity extends AppCompatActivity , which at first was not a problem. I tried to create material. Dark theme as shown here , but @android:style/Theme.Material does not work with AppCompatActivity . Now it works when main_activity simply extends the Activity .

Do I need AppCompatActivity with min sdk 21, if I want to use functions like Action Bar , or is it normal, only from Activity , I thought that AppCompatActivity and v7 Support Libraries exist to support lower sdk in order to be able to use Material Design What am I missing?

If it is not required at sdk level 21 and why, if Android studio set it as the default value, even if value 21 is set as min sdk?

I assume that one of the main questions I have is the best practice of using a material design theme, as described here in conjunction with AppCompatActivity, which Android Studio uses by default.

+6
source share
3 answers

Support libraries are needed if you want to provide newer SDK features for older platforms. If your minSDK = 5, you need support libraries only if they contain something that is not included in the 5 SDK for Android.

+1
source

Yes, you should use application compatibility libraries and snippets.

Fixed bugs related to support libraries. This way, Google can fix the error on Android without waiting for people to update their phones.

Best to use support libraries including AppCompat and FragmentCompat

As for topics, your topics should look like this:

<style name="AppTheme" parent="Theme.AppCompat">

see this https://medium.com/google-developers/theming-with-appcompat-1a292b754b35#.988b91sl1

+1
source

No, but there are useful presentations in the design and support-v4 support library that you may need.

Design:

  • Navigationview

Support-v4:

  • DrawerLayout

And if you go along this route and want to use the β€œregular” Fragments and a ViewPager , you need to use support-v13 .

0
source

All Articles