android - The method setActionBar(Toolbar) in the type Activity is not applicable for the arguments (Toolbar) -
this xml toolbar layout...
<?xml version="1.0" encoding="utf-8"?> <android.support.v7.widget.toolbar xmlns:android="http://schemas.android.com/apk/res/android" android:id="@+id/mtoolbar" android:layout_width="match_parent" android:layout_height="match_parent"> </android.support.v7.widget.toolbar>
i'm using support library use toolbar actionbar. did in oncreate...
toolbar mtoolbar = (toolbar)getlayoutinflater().inflate(r.layout.toolbar, null); setactionbar(mtoolbar);
but if gives me red squigglies , tells me message in title. i'm like, lulwut?!
you need setsupportactionbar
instead. using toolbar
means should using appcompatactivity
, , stuff lives in appcompat (~support) library.
edit: answer still applies if using now-deprecated actionbaractivity
, since actionbaractivity
inherits setsupportactionbar
method appcompactactivity
.
Comments
Post a Comment