创建的视图副本? [英] Creating a copy of a View?

查看:111
本文介绍了创建的视图副本?的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我有2个活动:一,活动A的B.Layout,有一个ViewGroup中的用户改变它的content.In活动B,我要再次表明,ViewGroup中,没有任何改变,它必须是一个真正的副本ViewGroup中,这样的文本,颜色,尺寸,为了(孩子的)和......必须same.So我不能使用布局充气。是有可能,而无需创建类的那ViewGroup中和变革性儿童的类型呢?因为如果我有2个以上的活动有不同的viewgroups,这是非常困难的,以显示每一项活动的viewgroups的最后一个活动。

I have 2 Activities: A,B.Layout of Activity A,has a viewgroup that user changes it's content.In Activity B,I have to show that viewgroup again,without any change,it must be a real copy of that viewgroup,so texts,colors,dimensions,order(of childs) and ... must be same.So I can not use Layout Inflater.Is it possible without creating classes of the type of childrens of that viewgroup and change properties?Because if I have more than 2 Activity with different viewgroups,it is very difficult to show viewgroups of each activity in last Activity.

另外,我无法从他们的父母删除这些viewgroups。

Also I can not remove those viewgroups from their parents.

推荐答案

如果他们的内容是相同的,存在有两种不同的行为没有意义。可以动态改变一个活动的内容和行为将是相同的,因为有两种活动。如果确有必要,那么你将不得不保存所有需要的信息,再次重建活动,并把它传递到新创建的活动。看看这个

If their content will be the same, there is no point in having two different activities. You can dynamically change one activity' s content and the behavior will be the same as there were two activities. If it is really necessary, then you will have to save all the needed information to reconstruct the activity again and pass it to the newly created activity. Take a look at this.

这篇关于创建的视图副本?的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

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