I create a scene that resizes a view from full to half the screen. It works on portrait mode, but the layout_height value is not enough for landscape mode. Is there a way to set a different value of a property in a XML scene file according to a specific orientation? If not, do I have to change it programmatically and how?
<MotionScene
xmlns:android="http://schemas.android.com/apk/res/android"
xmlns:motion="http://schemas.android.com/apk/res-auto">
<Transition
motion:constraintSetEnd="@+id/end"
motion:constraintSetStart="@id/start"
motion:duration="500">
<KeyFrameSet>
</KeyFrameSet>
</Transition>
<ConstraintSet android:id="@+id/start">
<Constraint
android:id="@+id/content_parent"
motion:layout_constraintEnd_toEndOf="parent"
android:layout_width="match_parent"
android:layout_height="match_parent"
motion:layout_constraintTop_toTopOf="parent"
motion:layout_constraintStart_toStartOf="parent" />
</ConstraintSet>
<ConstraintSet android:id="@+id/end">
<Constraint
android:id="@+id/content_parent"
motion:layout_constraintEnd_toEndOf="parent"
android:layout_width="match_parent"
android:layout_height="@dimen/section_height"
motion:layout_constraintTop_toTopOf="parent"
motion:layout_constraintStart_toStartOf="parent" />
</ConstraintSet>
UPDATE @ivan-wooll
Here's how I did:
//dimens.xml
<dimen name="section_height" tools:ignore="ResourceCycle">@dimen/section_height</dimen>
//dimens.xml(port)
<dimen name="section_height">280dp</dimen>
//dimens.xml(land)
<dimen name="section_height">60dp</dimen>
question from:
https://stackoverflow.com/questions/65937806/how-to-change-transition-values-according-to-orientation-in-a-motionlayout 与恶龙缠斗过久,自身亦成为恶龙;凝视深渊过久,深渊将回以凝视…