我总是使用Activity进入/返回转换(使用幻灯片和淡入淡出的动画视图等xml转换),并始终工作,因为它非常简单。现在在我的最后一个项目中,即使使用虚拟活动(没有任何实际的处理)也存在问题,转换根本不起作用,因此经过几小时更改布局代码后,我发现负责的是根的FrameLayout中的android:background
布局,我设置了一些背景颜色。当我删除这个属性时,转换重新开始。另外,如果我仅在活动主题中应用此属性,则转换将再次停止。android:后台查杀活动进入/返回转换
目前我的项目只有动画,只有具有这种布局结构的第二个活动:
<FrameLayout xmlns:android="http://schemas.android.com/apk/res/android"
xmlns:app="http://schemas.android.com/apk/res-auto"
xmlns:tools="http://schemas.android.com/tools"
android:background="@color/colorPrimary"
android:layout_width="match_parent"
android:layout_height="match_parent">
<ImageView>
<RecyclerView>
</FrameLayout>
和过渡从底部做幻灯片中的ImageView从顶部和幻灯片中RecyclerView。但就像我说的。它只适用于根FrameLayout没有背景颜色。
你有任何想法,如果它是一个错误或其他?
编辑:如果我用一个丑陋的虚拟视图只是提供背景颜色,转变工作:
<FrameLayout xmlns:android="http://schemas.android.com/apk/res/android"
xmlns:app="http://schemas.android.com/apk/res-auto"
xmlns:tools="http://schemas.android.com/tools"
android:layout_width="match_parent"
android:layout_height="match_parent">
<View
android:layout_width="match_parent"
android:layout_height="match_parent"
android:background="@color/colorPrimary" />
<ImageView>
<RecyclerView>
</FrameLayout>
编辑2:如果我用另一根ViewGroup中一样的LinearLayout代替同样的问题发生的FrameLayout 。
你确定你使用的有效颜色或有效的drawable? – matoni
是的,我正在使用主要应用主题的colorPrimary来测试pourposes,它在应用中显示,但过渡不起作用。 –
你能提供一段代码如何设置这种颜色? – matoni