Roman Truba Roman Truba - 1 year ago 73
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"?>
... 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 Source

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.