Error : IllegalArgumentException: The style on this component requires your app theme to be Theme.MaterialComponents

前端 未结 5 890
迷失自我
迷失自我 2020-11-29 08:00

Below are my dependencies

implementation \'com.google.android.material:material:1.0.0\'
implementation \'androidx.appcompat:appcompat:1.0.2\'
implementation          


        
5条回答
  •  忘掉有多难
    2020-11-29 08:35

    Extend your base app Theme from Material Components Bridge theme. It extends AppCompat theme, but add all necessary stuff.

    
    

    Both Theme.MaterialComponents and Theme.MaterialComponents.Light have .Bridge themes:

    Theme.MaterialComponents.Bridge
    Theme.MaterialComponents.Light.Bridge
    Theme.MaterialComponents.NoActionBar.Bridge
    Theme.MaterialComponents.Light.NoActionBar.Bridge
    Theme.MaterialComponents.Light.DarkActionBar.Bridge

    If allows you to keep using latest version of the library, but avoid a lot of UI issues, caused by migration to pure Material Component theme

    https://material.io/develop/android/docs/getting-started/#bridge-themes

提交回复
热议问题