问题标签 [fragment-transitions]

For questions regarding programming in ECMAScript (JavaScript/JS) and its various dialects/implementations (excluding ActionScript). Note JavaScript is NOT the same as Java! Please include all relevant tags on your question; e.g., [node.js], [jquery], [json], [reactjs], [angular], [ember.js], [vue.js], [typescript], [svelte], etc.

0 投票
1 回答
306 浏览

android - 如何在棉花糖中读取动画比例持续时间标志

Animation scale duration在 Marshmallow 中阅读 flag 时遇到问题。相同的代码在早期版本的 Marshmallow (6.0.0) 中工作。

我正在使用android.app.Fragment.setCustomTransition()片段动画的方法。当动画比例持续时间为 0 时developer option settings,片段不会显示。所以我不得不在这种情况下禁用动画。

我的代码片段:

true问题是:即使动画比例持续时间不是 0,此代码也会在每次调用时返回。

有没有人遇到过这个问题?

编辑1

以下是我使用isAnimationOff()方法加载片段的代码片段:

编辑2

这是具有自定义属性的自定义 LinearLayout:

0 投票
2 回答
5376 浏览

android - Fragment enter and exit transitions are not executed at the same time

Running a simple slide to the left animation for both entering and existing fragment produces the effect of the entering fragment slightly overlapping with the exit fragment. This leads me to think that both transition are not executed at the same time. Any clue or confirmation of this behavior?

The desired effect is to slide the fragments to the left at the same time, without overlap.

The code:

The only workaround by know it has been to add a setStartDelay(30) for the entering transition. But weird thing, I have different transitions for different fragments and the startDelay has to be different to produce the effect of both fragment sliding to the left at the same time.

0 投票
0 回答
228 浏览

android - 两个片段之间的共享元素转换,保持第一个片段可见

我让两个片段之间的共享元素转换工作正常。但是,问题是我不想隐藏第一个片段 - 我希望它显示在新添加的第二个片段下方。如果我不包含ft.hide( firstFragment )在我FragmentTransaction的共享元素转换将不会运行。

如何制作使两个片段都可见的共享元素转换?

0 投票
1 回答
953 浏览

android - Android 中的片段转换与 MVVMCross

在 MVVMCross 中很容易开发Activity转换,但我发现尝试用片段开发它有很多麻烦。

我有一个带有汉堡菜单的应用程序,我希望能够编辑自己的片段之间的转换。我一直在互联网上搜索,但找不到任何解决方案。

感谢您的关注。

0 投票
1 回答
1588 浏览

android - HashMap 将 onSaveInstanceState 从 Fragment 存储和恢复到另一个 Activity

需要恢复HashMap<String, Marker> markers; 从另一个活动打开片段时存储的标记。

这是我尝试过的:

当片段从另一个活动的暂停状态恢复时,我想恢复片段上的标记。例如: Activity A 包含 Fragment FA,在前台调用 Activity B 然后在后台再次打开 Fragment FA:

0 投票
3 回答
2301 浏览

android - 如何用后堆栈中的另一个片段替换多个片段?

我在后堆栈A, B, C中有以下片段。然后我想添加片段D,但在后面的堆栈中我想放A 和 D而不是A, B, C, D。问题是当我尝试用 删除 B 和 C 时transaction.remove()backStackEntryCount仍然是旧的,在按回时会出现空白屏幕。有没有办法处理这个?

当我使用popBackStack()它时,它会转到片段 A,然后是 D,​​这会产生奇怪的动画效果。

编辑:问题不是重复的,因为它被标记了,因为这个问题更多的是控制后堆栈中几个片段的顺序。

0 投票
0 回答
298 浏览

android - GLSurfaceView 在片段过渡期间变黑

在我的应用程序的一个片段中,我使用 aGLSurfaceView来渲染 3d 模型。当这个 Fragment 可见时,用户可以从中导航到另一个 Fragment。当片段过渡发生时,整个GLSurfaceView变黑。

当我从更改setZOrderOnTop(true)为 false 时,我开始遇到这个问题。我理解这带来的不同,但我无法使用setZOrderOnTop(true)(我有其他需要覆盖的视图和动画GLSurfaceView)。

我已经尝试了所有我能想到的以及与 Google 搜索相关的所有内容,例如使用背景、隐藏视图、在过渡期间将其替换为虚拟视图等,但没有任何运气。

有谁知道我该如何解决这个问题?

笔记:

  • 不能使用setZOrderOnTop(true)
  • 我使用支持片段
  • 我目前正在运行 6.0 marshmallow 的 Sony xperia z3 上进行测试
  • 唯一遇到这个问题的时候是带有 的片段转换GLSurfaceView时,而不是当我转换它时。
  • 我的渲染器用于glClear(..)将整个视图颜色渲染为白色。我的问题不在 GL 代码中
0 投票
1 回答
2200 浏览

android - 使用片段共享过渡时返回过渡无法正常工作

我有 2 个片段ListMovieFragmentDetailMovieFragment.

我有一个ListMovieFragmentMainActivity. 我正在使用共享元素转换;当我单击中的图像视图时ListMovieFragmentonMovieSelectedMainActivity.

ListMovieFragment作品过渡。
但是当我单击back按钮时,从DetailMovieFragmentListMovieFragment 转换失败。

出了什么问题的 gif

这是MainActivity。我认为我在片段上设置过渡的组合不正确。

我的过渡 xml 文件:

片段列表

片段详细信息

活动主

0 投票
0 回答
267 浏览

android - 如何通过允许状态丢失提交来使用 popBackStackImmediate

我在我的活动中调用了 popBackStackImmediate。我想调用此方法,但允许 stateloss 提交,因为它正在执行此方法:commitAllowingStateLoss。有办法吗?

0 投票
1 回答
389 浏览

android - 使用 fragment.setEnterTransition 有效,但在 Exit 上也会出现相同的动画,尽管我没有设置任何 exitTransition

以下代码也适用于进入动画和退出动画,我不希望它在退出时设置动画。我在这里做错了什么。?