Android Support Library: Consistent Design with AppCompat

Google for Developers · 67K views · 2015 · 2:42

Open on YouTube

Software (other)UX & UI designtutorialdated

Why Stack Overflow recommends it

Stack Overflow users link it when answering questions about AppCompat theming, the move from ActionBarActivity to AppCompatActivity, and getting Material design on older API levels.

Recommended by 3 people across 3 different months, 2015 to 2018.

What it is

A short Google Developers DevByte from 2015 that explains what the Android Support Library's AppCompat provides: a consistent Material-style design baseline on Android 2.1 and up. It shows how to integrate AppCompat into an existing app, including the theme and AppCompatActivity changes.

What people said

Recommends ianhanniballake · 2015-05 · Stack Overflow · on “Maintaining backward compatibility with Material Design”

If you are using AppCompat, then all of the material color palette [LINK] attributes (such as colorPrimary ) are available to all API levels, so you can write a single theme: <style name="AppTheme" parent="Theme.AppCompat.Light.DarkActionBar"> <item name="colorPrimary">@color/primary</item> <item name="colorPrimaryDark">@color/primary_dark</item> <item name="colorAccent">@color/accent</item> </style> And use AppCompatActivity [LINK] for all of your activities as per the Consistent Design with AppCompat DevByte [this video] . This will give you an action bar with colorPrimary on all API7+ devices, a status bar of colorPrimaryDark on API21+ devices (older devices do not support colored status bars)

Recommends Jorge Casariego · 2015-06 · Stack Overflow · on “Default Template on Android Studio deprecated”

According to this video [this video] you should only make two changes After I did this 2 changes all worked fine For more information about this you have this [1] [LINK] and this blog [LINK] UPDATE 1 After this change, clean your project and Sync Project with Gradle File. UPDATE 2 If after that you have problem resolving symbol R errors after an SDK update in Android Studio you can follow the steps showing in this blog [LINK]

Recommends ianhanniballake · 2015-06 · Stack Overflow · on “Appropriate way to use Android Support Library”

I wrote a portion of it, as well as produced a number [LINK] of [this video] videos [LINK] on its usefulness. The support library doesn't cover everything, but you'll find it saves you a lot of time in almost all cases.

Recommends Sayem · 2018-01 · Stack Overflow · on “When should I use appcompat libraries android?”

You should & you need to. why: android os is emerging new features and updates day by day. To give these features & updates in older version this is the way. Consistent UI looks for all versions. check this [this video] out.

Cites ianhanniballake · 2015-05 · Stack Overflow · on “Theming and AppCompat”

Toolbars are a concept only added as part of material design [LINK] - AppCompat is designed to bring consistent design [this video] across all API versions, matching material design guidelines. Therefore if you want to use a Holo theme, you should stick to using the Holo ActionBar [LINK] and not use Toolbars or AppCompat. Note that your app will look considerably out of place on newer devices as well as not match any of the Google apps (which all use a material design styling even on older versions of Android).

Cites Jorge Casariego · 2015-06 · Stack Overflow · on “Android Studio : All of a sudden cannot resolve symbol 'ActionBarActivity'”

According to this video [this video] of Android Developers you should only make two changes: 1. AndroidManifest.xml <application android:theme="@style/**Theme.App.Compact**"> 2. Change every Activity with ActionBarActivity like this public class MainActivity extends AppCompatActivity

Cites Antroid · 2015-09 · Stack Overflow · on “getActionBar returns null”

In case when you are developing an app which is targeting sdk>=14 , and you are extending AppCompat to support Material theme in previous versions also . When you want to hide the items from your action bar like the back button you need to do this : In your activity (not in the fragment class) If you will you use getActionBar() it will return null. as in Appsupport theme getSupportAcionBar() will return the action bar. Here is the link if you want to follow from DevByte [this video] protected void onCreate(Bundle savedInstanceState) { super.onCreate(savedInstanceState); setContentView(R.layout.activity_detail); getSupportActionBar().setDisplayHomeAsUpEnabled(false); }