2017-07-25 15 views
0

我總是使用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 。

+0

你確定你使用的有效顏色或有效的drawable? – matoni

+0

是的,我正在使用主要應用主題的colorPrimary來測試pourposes,它在應用中顯示,但過渡不起作用。 –

+0

你能提供一段代碼如何設置這種顏色? – matoni

回答

1

我用朋友提示找到了解決方案(或解決方法):

如果我用根的FrameLayout這個屬性,轉變工作方式:

android:transitionGroup="false"