setSupportActionBar (androidx.appcompat.widget.Toolbar) in AppCompatActivity cannot be applied

前端 未结 8 1473
半阙折子戏
半阙折子戏 2020-12-07 05:36

An error showing incompatible types Android widget toolbar cannot be converted in Java compiler while working on Android Studio.

    Toolbar toolbar = (Toolb         


        
8条回答
  •  暖寄归人
    2020-12-07 06:07

    AndroidX is the new and improved support library

     import androidx.appcompat.widget.Toolbar;
    

    you can check more about from here here

    Androidx's toolbar is designed for backwards compatibility while

    android.widget.Toolbar

    is the current plattform type

提交回复
热议问题