片段不显示 [英] Fragment is not showing

查看:151
本文介绍了片段不显示的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

问题是有点怪异和复杂的 - 有时(它是不确定的或者我不知道原因)我的一些片段,没有显示在交易了。

我查了两遍,而且似乎确定 - 片段正确前加入,不为空等等,具有字段 mHidden 设置为之前和交易后,但我看到的是一个空的地方。

有什么地方出错了?

要成为有关问题的详细precise - 我同时管理多个片段在一个活动(最多25个),以及隐藏的交易/显示一次很多。更重要的是,我有4个片段加入到相同的布局支架(的FrameLayout ),并切换它们的可见性 - 但我不认为这可能是原因。

我开始讨厌的Andr​​oid ...


解决方案

好吧,这是美妙的,你来了多久了一个解决方案,同时展示给别人你的问题 - 这里的问题是隐藏/显示动画 - 有一个使用情况下,当我被隐藏的片段与某些类型的动画(比例为0.0,褪色等)和后(特殊情况)显示它没有一个输入反向动画(作为优化) - 片段示出,但仍缩放到0或褪色。

The problem is a bit weird and complex - sometimes (it is not deterministic or I do not know the cause) some of my fragments are not showing up in transaction.

I checked everything twice, and it seems OK - fragment is correctly added before, is not null etc., has field mHidden set to true before and to false after the transaction, but all I see is an empty place.

What could be wrong?

To be more precise about the problem - I'm managing many fragments in one Activity (up to 25) at the same time, and the transactions hide / show many of them at once. What's more, I have 4 fragments added to the same layout holder (FrameLayout), and switching their visibility - but I don't think it may be the cause.

I'm starting to hate Android...

解决方案

OK, it's wonderful how often you come up with a solution while showing your problem to the others - the problem here was in hide / show animations - there was a use case when I was hiding a fragment with some kind of animation (scale to 0.0, fade, etc.) and later (special case) show it without an enter reverse animation (as an optimization) - fragment WAS shown, but remain scaled to 0 or faded.

这篇关于片段不显示的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

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