问题
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?- v21:
Widget.ProgressBar.Horizontal
- Support Library:
Widget.AppCompat.ProgressBar
- v21:
When should I use compat styles vs materialcomponents styles? Like
@style/TextAppearance.MaterialComponents.Body1
orTextAppearance.AppCompat.Title
?
Im still confused about MaterialComponents
and AppCompat
libraries differences.
回答1:
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
来源:https://stackoverflow.com/questions/53344551/how-to-style-an-app-migrating-to-materialcomponents-androidx-and-appcompat