Sophisticated and cool intro with Material Motion Animations.
👉 Check out who's using Material Intro
Add the dependency below to your module's build.gradle file:
dependencies { implementation("io.github.androidpoet:materialintro:1.0.8") }
<com.androidpoet.materialintro.MaterialIntroView android:id="@+id/materialintroView" android:layout_width="match_parent" android:layout_height="match_parent"> </com.androidpoet.materialintro.MaterialIntroView>
//add views into list list.add(R.layout.layout_one) list.add(R.layout.layout_two) list.add(R.layout.layout_three) with(binding.materialintroView) { setViewsList(list) nextAnimation = IntroAnimation.Fade previousAnimation = IntroAnimation.Fade nextDuration = 500 previousDuration = 500 } // go next view with animation binding.nextButton.setOnClickListener { binding.materialIntroFragment.next() } // go previous view with animation binding.backButton.setOnClickListener { binding.materialIntroFragment.previous() }
<com.androidpoet.materialintro.MaterialIntroFragment android:id="@+id/materialintroView" android:layout_width="match_parent" android:layout_height="match_parent"> </com.androidpoet.materialintro.MaterialIntroFragment>
//add fragments into list list.add(FragmentOne()) list.add(FragmentTwo()) list.add(FragmentThree()) binding.materialIntroFragment.apply { setFragmentsList(list) enterAnimation = IntroAnimation.SharedAxisXForward enterDuration = 500 } // go next view with animation binding.nextButton.setOnClickListener { binding.materialintroView.next() } // go previous view with animation binding.backButton.setOnClickListener { binding.materialintroView.previous() }
IntroAnimation.None IntroAnimation.FadeThrough IntroAnimation.Fade IntroAnimation.SharedAxisXForward IntroAnimation.SharedAxisYForward IntroAnimation.SharedAxisZForward IntroAnimation.SharedAxisXBackward IntroAnimation.SharedAxisYBackward IntroAnimation.SharedAxisZBackward IntroAnimation.ElevationScaleGrow IntroAnimation.ElevationScale
We can create the MaterialIntro using MaterialIntro.Builder.
val meta = MaterialIntroFragment.Builder(this) .setFragmentsList(list) .setEnterAnimation(IntroAnimation.Fade) .setEnterDuration(300) .setEnterOverlap(true) .build() meta.next() meta.previous()
This is how to create an instance of the MaterialIntro using kotlin dsl.
val meta = materialIntroFragment(this) { setFragmentsList(list) setEnterAnimation(IntroAnimation.Fade) setEnterDuration(300) setEnterOverlap(true) build() } meta.next() meta.previous()
Card icons created by Freepik - Flaticon
Support it by joining stargazers for this repository. ⭐
Copyright 2022 AndroidPoet (Ranbir Singh) Licensed under the Apache License, Version 2.0 (the "License"); you may not use this file except in compliance with the License. You may obtain a copy of the License at http://www.apache.org/licenses/LICENSE-2.0 Unless required by applicable law or agreed to in writing, software distributed under the License is distributed on an "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. See the License for the specific language governing permissions and limitations under the License.


