mmo
mmo

Reputation: 4246

Android: can one alias a layout?

I have two Activities that both list items in a table. For the time being both currently use the same layout and then inflate it at runtime.

However, to cleanly and strictly separate the two and also allow me to later maybe have slightly different layouts for each, I would like to have two different layout names but simply alias (is that a verb?) one layout to point to the other.

Can that be done? I tried to define an alias id in the strings.xml file but that only yields errors.

Michael

Upvotes: 4

Views: 1414

Answers (2)

Gunanaresh
Gunanaresh

Reputation: 979

There is this more straight forward layout aliasing technique as well. You can refer to: https://developer.android.com/training/multiscreen/screensizes.html#TaskUseAliasFilters

Upvotes: 2

Tyler
Tyler

Reputation: 22116

What if you have one of them simply contain nothing but a single <include> element so that it just includes the other one?

http://developer.android.com/resources/articles/layout-tricks-merge.html

Upvotes: 0

Related Questions