so I figured out that at runtime `toolbarLayout` i...
# android
o
so I figured out that at runtime
toolbarLayout
is toolbar I’m looking for but it is a
View
as included might be any view… but how can I get it as
Toolbar
without casting ?
l
just to be sure…, you’re using
setSupportActionBar(toolbarWidget)
but your layout is not a
android.support.v7.widget.Toolbar
is that correct?
o
it is
android.support.v7.widget.Toolbar
but it is in separate layout xml file and than included in main layout file.
<include>
tag and
Toolbar
has different ids. I can get my Toolbar by id of
<include>
tag but it is available as a
View
. So I’m looking for a way to get my
Toolbar
, probably by it’s id (specified in separate layout file)
l
you shouldn’t use the <include> id
I have the exact same case as you doing and I use the toolbar id without any problem, my imports are different though
Copy code
import kotlinx.android.synthetic.main.activity_home.*
import kotlinx.android.synthetic.main.content_home.*
import kotlinx.android.synthetic.main.toolbar.*
I’m not importing using
toolbar.view.*
instead
toolbar.*