I want to migrate to:
androidx.appcompat:appcompat
com.google.android.material:material
And forget about support library dependencies, but I have some questions:
Which style should I use for ProgressBar
in order to maintain compatibility?
Widget.ProgressBar.Horizontal
Widget.AppCompat.ProgressBar
When should I use compat styles vs materialcomponents styles?
Like @style/TextAppearance.MaterialComponents.Body1
or TextAppearance.AppCompat.Title
?
Im still confused about MaterialComponents
and AppCompat
libraries differences.
With Android Studio 3.2 and higher, you can migrate an existing project to AndroidX by selecting Refactor > Migrate to AndroidX from the menu bar. The refactor command makes use of two flags. By default, both of them are set to true in your gradle.
So, if you want bug fixes or new features that would have previously gone into the Support Library, you need to migrate to AndroidX. Better package management. With AndroidX, you get standardized and independent versioning, as well as better standardized naming and more frequent releases.
Android AppCompat Library The Support Library is a static library that you can add to your Android application in order to use APIs that are either not available for older platform versions or utility APIs that aren't a part of the framework APIs. Compatible on devices running API 14 or later.
Android provides the following features to help you build material design apps: A material design app theme to style all your UI widgets. Widgets for complex views such as lists and cards.
MaterialComponents is built on top of AppCompat, so generally AppCompat styles will work. However, if a MaterialComponents version of a style exists, you should use that instead.
For ProgressBar specifically, as of now there is no MaterialComponents version so you should use an AppCompat style such as Widget.AppCompat.ProgressBar
. There's more info from a similar question here: https://github.com/material-components/material-components-android/issues/218
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With