Roman Truba Roman Truba - 7 days ago 5
Android Question

Include layout with custom attributes

I making complex layout and I using "include" for my custom component, like this

<include layout="@layout/topbar"/>


And topbar defined like this:

<?xml version="1.0" encoding="utf-8"?>
<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"/>


But I have no result. I understood from that page that I can set no attributes, but id, height and width.

So, how can I pass my custom defined attributes to include, and how can I make it work?

Answer

Unfortunately, the only thing I can contribute is that I was also unable to set custom attributes on an include tag, and have them pass through to the included layout.

It may well not be possible at this point.

Comments