android-motionlayout

How to drive MotionLayout animation while scrolling…like Google Chrome

六月ゝ 毕业季﹏ 提交于 2021-02-11 04:03:18
问题 I think we all know this behavior of Google Chrome on Android where you scroll down and the menu bar disappears. This is no problem with "OnSwipe" in a motion scene file. The problems I have are regarding the reversed behavior where you can scroll up somewhere in the middle of a page and while doing that the menu bar appears again. I tried this with a NestedScrollView in a MotionLayout and for me it seams like I can only drive the MotionLayout's animation when the NestedScrollView isn't

How to handle <OnClick> and onClickListener in MotionLayout similar to Youtube

本秂侑毒 提交于 2021-02-07 22:48:31
问题 I have been trying to understand how MotionLayout works and after some trying I have a question as to how OnClick works for a View. I have something that I tried from official examples. I tried something similar to the youtube swiping. scene_24.xml <Transition motion:constraintSetEnd="@+id/end" motion:constraintSetStart="@+id/start" motion:duration="1000" motion:motionInterpolator="linear"> <OnSwipe motion:dragDirection="dragUp" motion:touchAnchorSide="bottom" motion:touchRegionId="@+id/top

How to handle <OnClick> and onClickListener in MotionLayout similar to Youtube

懵懂的女人 提交于 2021-02-07 22:48:21
问题 I have been trying to understand how MotionLayout works and after some trying I have a question as to how OnClick works for a View. I have something that I tried from official examples. I tried something similar to the youtube swiping. scene_24.xml <Transition motion:constraintSetEnd="@+id/end" motion:constraintSetStart="@+id/start" motion:duration="1000" motion:motionInterpolator="linear"> <OnSwipe motion:dragDirection="dragUp" motion:touchAnchorSide="bottom" motion:touchRegionId="@+id/top

MotionLayout: OnSwipe and OnClick on same view

亡梦爱人 提交于 2021-01-21 07:31:28
问题 I am using MotionLayout for my page. I have two states which is toggled with OnSwipe of a view: <Transition motion:constraintSetStart="@+id/start" motion:constraintSetEnd="@+id/end" motion:duration="700" motion:motionInterpolator="easeIn"> <OnSwipe motion:dragDirection="dragUp" motion:touchAnchorId="@+id/view" motion:touchAnchorSide="bottom" motion:touchRegionId="@+id/view" /> </Transition> I also want to add OnClickListener to this view from code, or add new Transition in scene.xml file,

How to restore transition state of MotionLayout without auto-playing the transition?

跟風遠走 提交于 2021-01-05 07:21:06
问题 My code Activity class SwipeHandlerActivity : AppCompatActivity(R.layout.activity_swipe_handler){ override fun onSaveInstanceState(outState: Bundle) { super.onSaveInstanceState(outState) outState.putBundle("Foo", findViewById<MotionLayout>(R.id.the_motion_layout).transitionState) } override fun onCreate(savedInstanceState: Bundle?) { super.onCreate(savedInstanceState) savedInstanceState?.getBundle("Foo")?.let(findViewById<MotionLayout>(R.id.the_motion_layout)::setTransitionState) } } Layout <

How to restore transition state of MotionLayout without auto-playing the transition?

空扰寡人 提交于 2021-01-05 07:20:06
问题 My code Activity class SwipeHandlerActivity : AppCompatActivity(R.layout.activity_swipe_handler){ override fun onSaveInstanceState(outState: Bundle) { super.onSaveInstanceState(outState) outState.putBundle("Foo", findViewById<MotionLayout>(R.id.the_motion_layout).transitionState) } override fun onCreate(savedInstanceState: Bundle?) { super.onCreate(savedInstanceState) savedInstanceState?.getBundle("Foo")?.let(findViewById<MotionLayout>(R.id.the_motion_layout)::setTransitionState) } } Layout <

KeyAttribute in MotionLayout is ignored on view “visibility” change

久未见 提交于 2021-01-04 02:07:24
问题 I'm using MotionLayout and <MotionScene /> to animate a bottomSheet View content, following swipe animation. Between start and end scenes I'd like to make appear a view view_player_status_margin using visibility from gone to visible (not using alpha because an other view is link by constraint to the one I want to make appears). It's ok using standard <Constraint /> in <ConstraintSet /> , but when I link visibility to a <KeyAttribute /> to make the view appears only on last frames of the

KeyAttribute in MotionLayout is ignored on view “visibility” change

大憨熊 提交于 2021-01-04 02:03:07
问题 I'm using MotionLayout and <MotionScene /> to animate a bottomSheet View content, following swipe animation. Between start and end scenes I'd like to make appear a view view_player_status_margin using visibility from gone to visible (not using alpha because an other view is link by constraint to the one I want to make appears). It's ok using standard <Constraint /> in <ConstraintSet /> , but when I link visibility to a <KeyAttribute /> to make the view appears only on last frames of the

KeyAttribute in MotionLayout is ignored on view “visibility” change

狂风中的少年 提交于 2021-01-04 01:58:42
问题 I'm using MotionLayout and <MotionScene /> to animate a bottomSheet View content, following swipe animation. Between start and end scenes I'd like to make appear a view view_player_status_margin using visibility from gone to visible (not using alpha because an other view is link by constraint to the one I want to make appears). It's ok using standard <Constraint /> in <ConstraintSet /> , but when I link visibility to a <KeyAttribute /> to make the view appears only on last frames of the

Motionlayout: WARNING could not find view id -1

青春壹個敷衍的年華 提交于 2020-12-15 19:33:14
问题 My problem is, that I constantly get the warning W/MotionLayout: WARNING could not find view id -1 . Because of this, my MotionLayout is really laggy and nearly jumps from the expanded state to the collapsed state . After waiting a couple of seconds, the animation starts getting better (no jumping / laggs anymore), but the warning remains. Base XML <layout xmlns:android="http://schemas.android.com/apk/res/android" xmlns:app="http://schemas.android.com/apk/res-auto" xmlns:tools="http://schemas