开发者

Android: can one alias a layout?

开发者 https://www.devze.com 2023-01-16 01:35 出处:网络
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.

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


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


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

0

精彩评论

暂无评论...
验证码 换一张
取 消