Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

What is the difference between Theme.AppCompat and Theme.Material in Android?

In My case, what is difference in here:

<style name="AppTheme" parent="android:Theme.Material.Light.DarkActionBar">

and

<style name="AppTheme" parent="Theme.AppCompat.Light.DarkActionBar">
like image 938
Phat Dang Avatar asked Apr 17 '17 17:04

Phat Dang


People also ask

What is material theme android?

Material Theme is a user interface style that determines the look and feel of views and activities starting with Android 5.0 (Lollipop). Material Theme is built into Android 5.0, so it is used by the system UI as well as by applications.

What are material themes?

A Material Theme contains color, typography and shape attributes. When you customize these attributes, your changes are automatically reflected in the components you use to build your app. Configure the parameters you pass to MaterialTheme to theme your application.

What is Coloronprimary in android Studio?

colorPrimary and colorSecondary represent the colors of your brand. colorPrimaryVariant and colorSecondaryVariant are lighter or darker shades of your brand colors. colorSurface is used for “sheets” of material (like cards and bottom sheets) android:colorBackground is the window background color of your app.

What is a theme overlay?

One of the concepts that was new to me was theme overlays. It's a powerful technique that allows us to override only the attributes that are specified in the overlay itself. The typical way to apply a theme overlay is using the android:theme attribute on our view.


2 Answers

This is the raw material design theme, which is used by Android 5 and upNot sure how this works wrt. new Android libraries for app design:

<style name="AppTheme" parent="android:Theme.*">

This is a way to use material design on pre-lollipop devices, which maintains compatibility.

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

You can design for newer APIs using AppCompat and still have it work on earlier API levels than what the base level for material design is.

In this case, it essentially means that you can run material design on platforms that predate material design. This isn't as important anymore now that versions that early make up at most ~2.5% of the market share at the time of writing.

Note, however, that using AppCompat does give you additional compatibility helpers beyond just being able to use the material theme on older devices. Also note that AppCompat has since been deprecated in favor of whatever system is currently mainstream and that Google hasn't axed yet (Jetpack?), which may or may not work differently.

like image 188
Zoe stands with Ukraine Avatar answered Oct 05 '22 14:10

Zoe stands with Ukraine


<style name="AppTheme" parent="Theme.AppCompat.Light.DarkActionBar">    
<style name="AppTheme" parent="android:Theme.Material.Light.DarkActionBar">

Theme.AppCompat is for above API 7+

Theme.Material is for above API 21+

like image 33
Navin Kumar Avatar answered Oct 05 '22 15:10

Navin Kumar