Skip to content

Instantly share code, notes, and snippets.

@ernestkamara
Last active January 3, 2020 12:39
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save ernestkamara/6bdc1a52add1b0e6fc2c1b628b26c8e3 to your computer and use it in GitHub Desktop.
Save ernestkamara/6bdc1a52add1b0e6fc2c1b628b26c8e3 to your computer and use it in GitHub Desktop.
MotionLayout for the Onboarding Screen
<?xml version="1.0" encoding="utf-8"?>
<androidx.constraintlayout.motion.widget.MotionLayout
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:id="@+id/motionLayout"
app:layoutDescription="@xml/onboarding_scene"
android:background="@color/onboarding_background"
android:layout_width="match_parent"
android:layout_height="match_parent">
<TextView
style="@style/TextAppearance.AppCompat.Title"
android:id="@+id/headingText"
android:layout_width="wrap_content"
android:layout_height="wrap_content" />
<ImageView
android:id="@+id/centerPlaceholder"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
app:layout_constraintBottom_toBottomOf="parent"
app:layout_constraintEnd_toEndOf="parent"
app:layout_constraintStart_toStartOf="parent"
app:layout_constraintTop_toTopOf="parent"
tools:ignore="ContentDescription" />
<io.kamara.android.samples.views.OnboardingBubbleItem
android:id="@+id/firstBubble"
android:layout_width="@dimen/onboarding_bubble_item_size_xlarge"
android:layout_height="@dimen/onboarding_bubble_item_size_xlarge"
android:background="@drawable/bubble_background"
android:backgroundTint="@color/color_onboarding_page1"
app:layout_constraintCircle="@+id/centerPlaceholder"
app:layout_constraintCircleAngle="290"
app:layout_constraintCircleRadius="90dp"/>
<io.kamara.android.samples.views.OnboardingBubbleItem
android:id="@+id/secondBubble"
android:layout_width="@dimen/onboarding_bubble_item_size_medium"
android:layout_height="@dimen/onboarding_bubble_item_size_medium"
android:background="@drawable/bubble_background"
android:backgroundTint="@color/color_onboarding_page2"
app:layout_constraintCircle="@+id/centerPlaceholder"
app:layout_constraintCircleAngle="120"
app:layout_constraintCircleRadius="160dp"/>
<io.kamara.android.samples.views.OnboardingBubbleItem
android:id="@+id/thirdBubble"
android:layout_width="@dimen/onboarding_bubble_item_size_small"
android:layout_height="@dimen/onboarding_bubble_item_size_small"
android:background="@drawable/bubble_background"
android:backgroundTint="@color/color_onboarding_page3"
app:layout_constraintCircle="@+id/centerPlaceholder"
app:layout_constraintCircleAngle="210"
app:layout_constraintCircleRadius="240dp"/>
</androidx.constraintlayout.motion.widget.MotionLayout>
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment