I'm building a complex layout and I want to use include
tag for my custom component, like this:
<include layout="@layout/topbar"/>
The topbar
layout has custom root component and in layout xml file it's defined like this:
<my.package.TopBarLayout
... a lot of code
Now, I wanna pass my custom defined attributes to "topbar" like this:
<include layout="@layout/topbar" txt:trName="@string/contacts"/>
And then get the value of those custom attributes in custom component code or ideally in xml.
Sadly, I cannot get value of txt:trName
attribute to make it to the topbar
layout, I just don't receive anything in code. If I understand correctly from that documentation page, I can set no attributes for layouts used via include
, but id
, height
and width
.
So my question is how can I pass my custom defined attributes to layout which is added via include
?
See Question&Answers more detail:
os 与恶龙缠斗过久,自身亦成为恶龙;凝视深渊过久,深渊将回以凝视…