如何包括布局两次的Andr​​oid? [英] How to include a layout twice in Android?

查看:133
本文介绍了如何包括布局两次的Andr​​oid?的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

Android的<有/> 元素,可以包含其他的XML布局。有用的跨多个活动的共同头。

Android's <include /> element allows you to include other XML layouts. Useful for a common header across several activities.

不过,如果你想包括一个布局的若干的时间在相同的看法呢?举例来说,我有,我想在我的视图中显示三次一个精心制作的布局。每一这些实例都需要不同的值。因为包括基本上是一个的采取XML并将其粘贴在这里的,我需要更强大的东西。

But, what if you want to include a layout several times in the same view? For instance, I have a carefully crafted layout that I want to display three times in my view. Every of those instances would need different values. Since the include is basically a take that XML and paste it here, I'd need something more powerful.

有一些机制来做到这一点?

Is there some mechanism to do this?

(我有没有正确地解释一下?)

(Did I explain myself correctly?)

推荐答案

在一篇博客文章<一个href="http://www.coboltforge.com/2012/05/tech-stuff-layout/">http://www.coboltforge.com/2012/05/tech-stuff-layout/正好说明这个问题(在相同的布局XML包括几次),以及如何解决它!

A blog post at http://www.coboltforge.com/2012/05/tech-stuff-layout/ explains exactly that problem (the same layout XML included several times) and how to solve it!

这篇关于如何包括布局两次的Andr​​oid?的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆