更改constraint.Group中元素的可见性 [英] Changing visibility of element in constraint.Group

查看:160
本文介绍了更改constraint.Group中元素的可见性的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我花了一个小时试图弄明白,谁正在改变我的观点之一。原来是约束。组。

I have spent an hour trying to figure out, who is changing one of my views visibility. It turned out to be constraint.Group.

嗯,从一开始:
我有,例如,次观看,五次他们(在某些情况下)应该有可见性GONE。 这些五个视图中的一个有自己的逻辑可见或不可见,但如果所有五个都消失了,它就会消失。我认为在约束中放置五个元素是一个好主意。组,为组应用逻辑,然后为其中一个应用逻辑。 错误:其中一个将与群组中的其他人具有相同的可见性,即使我在充气后更改它。

Well, from the start: I have, for example, seven views, five of them (under certain circumstances) should have visibility GONE. One of these five views have its own logic to be visible or not, but if all five are gone, it is gone. I thought it is a good idea to place five elements in a constraint.Group , apply logic for group, and then apply logic for one of them. Error: one of them will have the same visibility as other in a group, even if I change it after inflate.

必须是什么在这里完成保留两种逻辑?根本不使用constraint.Group?从constraint.Group中删除一个视图?

What has to be done here to preserve two kind of logic? Not using constraint.Group at all? Remove one view from constraint.Group?

推荐答案

是的,您肯定需要从 android.support.constraint.Group 如果您希望特定视图的可见性逻辑正常工作,否则无论 android.support.constraint.Group 将在那里;也将应用于该视图的可见性,这就是为什么你需要从 android.support.constraint.Group 中排除它以避免问题,从而得到你想要的结果。

Yes, definitely you will need to remove that one view from android.support.constraint.Group if you want that specific view's visibility logic to work correctly as otherwise whatever the visibility of the android.support.constraint.Group will be there; will also get applied to the visibility of that view and that's why you need to exclude it from the android.support.constraint.Group to avoid problems and thus get your desired outcome.

这篇关于更改constraint.Group中元素的可见性的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

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