setSupportActionBar toolbar cannot be applied to (android.widget.Toolbar) error

前端 未结 13 1413
没有蜡笔的小新
没有蜡笔的小新 2020-11-30 03:45

I\'ve been looking for an answer and I\'ve tried many possible solutions, but nothing seems to work..

I\'m trying to setup a Material Action Bar following this tutor

13条回答
  •  天涯浪人
    2020-11-30 04:18

    Adding import android.support.v7.widget.Toolbar to the import list resolve this issue.

    Then add the toolbar widget layout file:

    
    

    In onCreate method of java code

    //call to
    

    Tootbar toolbar = findViewById(R.id.toolbar); setSupportActionBar(toolbar);

    Source: https://developer.android.com/training/appbar/up-action

提交回复
热议问题