Motion-ShapeOfView

Explain how to use MotionLayout with ShapeOfView

Github星跟蹤圖

MotionShapeOfView

Explain how to use MotionLayout with ShapeOfView

This project is the sample of a medium article : https://medium.com/p/26a7ab10142f

https://github.com/florent37/ShapeOfView

dependencies {
    implementation 'com.github.florent37:shapeofview:1.4.6'
    implementation 'androidx.constraintlayout:constraintlayout:2.0.0-alpha2'
}

screen

screen

Layout

https://github.com/florent37/Motion-ShapeOfView/blob/master/app/src/main/res/layout/activity_arc_list.xml

<androidx.constraintlayout.motion.widget.MotionLayout
        xmlns:android="http://schemas.android.com/apk/res/android"
        xmlns:app="http://schemas.android.com/apk/res-auto"
        android:layout_width="match_parent"
        android:layout_height="match_parent"
        app:layoutDescription="@xml/collapsing_header_arc"
        app:showPaths="false">

    <androidx.recyclerview.widget.RecyclerView
            android:id="@+id/recyclerView"
            android:layout_width="0dp"
            android:layout_height="0dp"/>

    <com.github.florent37.shapeofview.shapes.ArcView
            android:id="@+id/header"
            android:layout_width="0dp"
            android:layout_height="200dp"
            android:elevation="4dp"
            app:shape_arc_cropDirection="outside"
            app:shape_arc_height="26dp"
            app:shape_arc_position="bottom">

        <androidx.appcompat.widget.AppCompatImageView
                app:srcCompat="@drawable/effeil_tower2"/>

    </com.github.florent37.shapeofview.shapes.ArcView>

    <androidx.appcompat.widget.AppCompatTextView
            android:id="@+id/headerText"
            android:text="I love paris"
            />

</androidx.constraintlayout.motion.widget.MotionLayout>

Motion

https://github.com/florent37/Motion-ShapeOfView/blob/master/app/src/main/res/xml/collapsing_header_arc.xml

<?xml version="1.0" encoding="utf-8"?>
<MotionScene xmlns:android="http://schemas.android.com/apk/res/android"
    xmlns:app="http://schemas.android.com/apk/res-auto">

    <Transition
        app:constraintSetEnd="@id/end"
        app:constraintSetStart="@id/start">

        <OnSwipe
            app:dragDirection="dragUp"
            app:touchAnchorId="@id/recyclerView"
            app:touchAnchorSide="top" />

    </Transition>

    <ConstraintSet android:id="@+id/start">
        <Constraint
            android:id="@id/header"
            android:layout_height="240dp"
            app:layout_constraintEnd_toEndOf="parent"
            app:layout_constraintStart_toStartOf="parent"
            app:layout_constraintTop_toTopOf="parent">
            <CustomAttribute
                app:attributeName="arcHeightDp"
                app:customFloatValue="60" />
        </Constraint>

        <Constraint
            android:id="@id/headerText"
            android:layout_width="wrap_content"
            android:layout_height="wrap_content"
            app:layout_constraintBottom_toBottomOf="@+id/header"
            app:layout_constraintEnd_toEndOf="parent"
            app:layout_constraintStart_toStartOf="parent"
            app:layout_constraintTop_toTopOf="@+id/header">

            <CustomAttribute
                app:attributeName="textSize"
                app:customFloatValue="40" />
        </Constraint>
    </ConstraintSet>

    <ConstraintSet android:id="@+id/end">
        <Constraint
            android:id="@id/header"
            android:layout_height="80dp"
            app:layout_constraintEnd_toEndOf="parent"
            app:layout_constraintStart_toStartOf="parent"
            app:layout_constraintTop_toTopOf="parent">
            <CustomAttribute
                app:attributeName="arcHeightDp"
                app:customFloatValue="0" />
        </Constraint>
        <Constraint
            android:id="@id/headerText"
            android:layout_width="wrap_content"
            android:layout_height="wrap_content"
            android:layout_marginStart="14sp"
            app:layout_constraintBottom_toBottomOf="@+id/header"
            app:layout_constraintStart_toStartOf="@+id/header"
            app:layout_constraintTop_toTopOf="@+id/header">

            <CustomAttribute
                app:attributeName="textSize"
                app:customFloatValue="20" />
        </Constraint>

    </ConstraintSet>

</MotionScene>

Fiches Plateau Moto

Utilisé dans l'application de révisions de permis moto, fiches plateau moto https://www.fiches-plateau-moto.fr/

主要指標

概覽
名稱與所有者florent37/Motion-ShapeOfView
主編程語言Kotlin
編程語言Kotlin (語言數: 1)
平台
許可證
所有者活动
創建於2018-11-19 13:54:53
推送於2019-04-17 04:14:48
最后一次提交2018-11-27 13:03:05
發布數0
用户参与
星數242
關注者數5
派生數31
提交數19
已啟用問題?
問題數2
打開的問題數2
拉請求數0
打開的拉請求數1
關閉的拉請求數0
项目设置
已啟用Wiki?
已存檔?
是復刻?
已鎖定?
是鏡像?
是私有?