6

我想迁移到:

  • androidx.appcompat:appcompat
  • com.google.android.material:material

忘记支持库依赖项,但我有一些问题:

  1. ProgressBar为了保持兼容性,我应该使用哪种样式?

    • v21:Widget.ProgressBar.Horizontal
    • 支持库:Widget.AppCompat.ProgressBar
  2. 我什么时候应该使用兼容样式和 materialcomponents 样式?喜欢@style/TextAppearance.MaterialComponents.Body1还是TextAppearance.AppCompat.Title

我仍然对MaterialComponentsAppCompat库的差异感到困惑。

4

1 回答 1

7

MaterialComponents 构建在 AppCompat 之上,因此通常 AppCompat 样式可以使用。但是,如果存在 MaterialComponents 版本的样式,则应该使用它。

特别是对于 ProgressBar,到目前为止还没有 MaterialComponents 版本,因此您应该使用 AppCompat 样式,例如Widget.AppCompat.ProgressBar. 这里有来自类似问题的更多信息:https ://github.com/material-components/material-components-android/issues/218

于 2018-11-26T15:49:11.463 回答