Any ideas how to implement scrollToPosition with MotionLayout? Currently I have a RecyclerView and some header that hides on scroll and shows if you scroll to top. This is the scene: <Transition motion:constraintSetEnd="@+id/end" motion:constraintSetStart="@id/start" motion:duration="1000"> <OnSwipe motion:touchAnchorId="@+id/header" motion:dragDirection="dragUp" motion:onTouchUp="stop" /> </Transition> <ConstraintSet android:id="@+id/start"> <Constraint android:id="@+id/header" android:layout_width="0dp" android:layout_height="wrap_content" android:visibility="visible" motion:layout_constraintEnd_toEndOf="parent" motion:layout_constraintStart_toStartOf="parent" motion:layout_constraintTop_toBottomOf="@id/toolbar" /> <Constraint android:id="@+id/recycler_view" android:layout_width="0dp" ..
Category : android-motionlayout

I am trying to implement animation using Motion layout. Agenda: On scrolling recycler view or scroll view, custom view should collapse and show only required end layout. start layout end layout end layout activity_main_start.xml <?xml version="1.0" encoding="utf-8"?> <androidx.constraintlayout.widget.ConstraintLayout 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" tools:context=".MainActivity"> <RelativeLayout android:id="@+id/topLayout" android:layout_width="0dp" android:layout_height="wrap_content" app:layout_constraintEnd_toEndOf="parent" app:layout_constraintStart_toStartOf="parent" app:layout_constraintTop_toTopOf="parent"> <TextView android:id="@+id/assetValue" android:layout_width="wrap_content" android:layout_height="wrap_content" ..

I’m wondering which method from MotionLayout may help me to re-create this animation the one you see a list of items. The animation is the same as the image, you tap on an item of the list and the images "makes bigger" until it fits to the detail activity. Is this necessary MotionLayout? Or it ..
Please tell someone who understands MotionLayout why does the scene periodically loop when swiping. Code here Source: Android..
I have a restaurants map-based app which when I click on a place marker, a fragment displaying the specific place is created with RecyclerView showing reviews about the place and a like button all inside a motion layout, when the fragment is created and the button is not liked (means the specific place showing is ..
I use MotionLayout for the animate view1. I want programmatically change constraint view1 to view2. I want to use different layout’s in my scene instead of using ConstrainsSet So, I have: res/xml/activity_scene.xml <Transition android:id="@+id/transition1" motion:constraintSetStart="@layout/activity_state1" motion:constraintSetEnd="@layout/activity_state2"> // <..> </Transition> res/layout/activity_state1.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:id="@+id/motionLayout" android:layout_width="match_parent" android:layout_height="match_parent" app:layoutDescription="@xml/activity_scene"> // viev1 is small and view1 at left ..
I have a motionlayout with a card that scales on swiped. But in some cases a textview with long text is scaled incorrect and change the number of lines. How it looks: https://youtu.be/SOAf8Zpa2Hk My Transotion and ConstraintSet: <Transition android:id="@+id/start_to_missed" motion:constraintSetEnd="@id/missed" motion:constraintSetStart="@id/start" motion:duration="300"> <OnSwipe motion:dragDirection="dragRight" motion:onTouchUp="autoComplete" motion:dragScale="5.0" motion:dragThreshold="0.9" motion:touchAnchorSide="right" motion:maxVelocity="20" motion:maxAcceleration="40" motion:touchRegionId="@id/word_card" /> </Transition> <ConstraintSet android:id="@+id/missed"> ..

MotionLayout: <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:layout_width="match_parent" android:layout_height="match_parent" tools:context=".MainActivity" app:layoutDescription="@xml/activity_main_scene"> <FrameLayout android:id="@+id/left_content" android:layout_width="match_parent" android:layout_height="match_parent" android:background="#0c0" > <TextView android:layout_width="wrap_content" android:layout_height="wrap_content" android:layout_gravity="right" android:text="right text" /> <TextView android:layout_width="wrap_content" android:layout_height="wrap_content" android:layout_gravity="left" android:text="left text" android:textColor="#33691E" /> </FrameLayout> <FrameLayout android:id="@+id/bar" android:layout_width="wrap_content" android:layout_height="match_parent" android:background="#c00" tools:ignore="SpeakableTextPresentCheck" tools:layout_editor_absoluteX="918dp"> <View android:layout_width="50dp" android:layout_height="match_parent" android:clickable="false" /> </FrameLayout> <FrameLayout android:id="@+id/right_content" android:layout_width="wrap_content" android:layout_height="match_parent" android:background="#00c" > <TextView android:layout_width="wrap_content" android:layout_height="wrap_content" android:textColor="#fff" android:layout_gravity="right" ..
I am using the motion layout with the recycleview where I am observing one issue Motion layout overrides the property of Recycleview onBindViewHolder called for every item in recycleView Source: Android..
I am creating animation in splashScreen with motionLayout. But my animation doesn’t work, instead it immediatly shows the ending positions of the elements on the screen. Here is my code: SplashActivity: class SplashActivity : AppCompatActivity() { override fun onCreate(savedInstanceState: Bundle?) { super.onCreate(savedInstanceState) setContentView(R.layout.activity_splash) motionLayout.transitionToEnd() val handler = Handler() handler.postDelayed( { startActivity(Intent(this, MainActivity::class.java)) finish() }, 3000) ..
Recent Comments