Skip to content

Commit

Permalink
Fix element doesn't follow transition
Browse files Browse the repository at this point in the history
  • Loading branch information
Super12138 committed Aug 15, 2024
1 parent 489e2e4 commit 773dbac
Showing 1 changed file with 9 additions and 0 deletions.
Original file line number Diff line number Diff line change
@@ -1,7 +1,9 @@
package cn.super12138.todo.views.welcome.pages

import android.os.Bundle
import android.view.View
import androidx.fragment.app.Fragment
import com.google.android.material.color.MaterialColors
import com.google.android.material.transition.MaterialSharedAxis

open class BasePage : Fragment() {
Expand All @@ -12,4 +14,11 @@ open class BasePage : Fragment() {
exitTransition = MaterialSharedAxis(MaterialSharedAxis.X, /* forward= */ true)
reenterTransition = MaterialSharedAxis(MaterialSharedAxis.X, /* forward= */ false)
}

// https://github.com/material-components/material-components-android/issues/1984#issuecomment-1089710991
override fun onViewCreated(view: View, savedInstanceState: Bundle?) {
super.onViewCreated(view, savedInstanceState)
// Overlap colors.
view.setBackgroundColor(MaterialColors.getColor(view, android.R.attr.colorBackground))
}
}

0 comments on commit 773dbac

Please sign in to comment.