Platform
Android Studio
Google Play
Jetpack
Docs
Blog
Download
What's New
User Guide
Preview
Home
Platform
Android Studio
Download
What's New
User Guide
Preview
Google Play
Docs
Blog
Download a Preview
Install Alongside Stable
New Features
Release Updates
Updates archive
►
2024
2024
(79)
►
októbra
októbra
(8)
►
septembra
septembra
(8)
►
augusta
augusta
(9)
►
júla
júla
(6)
►
júna
júna
(7)
►
mája
mája
(9)
►
apríla
apríla
(9)
►
marca
marca
(6)
►
februára
februára
(8)
►
januára
januára
(9)
►
2023
2023
(76)
►
decembra
decembra
(4)
►
novembra
novembra
(9)
►
októbra
októbra
(7)
►
septembra
septembra
(8)
►
augusta
augusta
(3)
►
júla
júla
(4)
►
júna
júna
(6)
►
mája
mája
(10)
►
apríla
apríla
(4)
►
marca
marca
(7)
►
februára
februára
(9)
►
januára
januára
(5)
►
2022
2022
(59)
►
decembra
decembra
(3)
►
novembra
novembra
(5)
►
októbra
októbra
(8)
►
septembra
septembra
(4)
►
augusta
augusta
(4)
►
júla
júla
(2)
►
júna
júna
(7)
►
mája
mája
(6)
►
apríla
apríla
(5)
►
marca
marca
(6)
►
februára
februára
(5)
►
januára
januára
(4)
►
2021
2021
(54)
►
decembra
decembra
(3)
►
novembra
novembra
(2)
►
októbra
októbra
(6)
►
septembra
septembra
(4)
►
augusta
augusta
(5)
►
júla
júla
(8)
►
júna
júna
(4)
►
mája
mája
(5)
►
apríla
apríla
(1)
►
marca
marca
(7)
►
februára
februára
(4)
►
januára
januára
(5)
►
2020
2020
(107)
►
decembra
decembra
(7)
►
novembra
novembra
(3)
►
októbra
októbra
(8)
►
septembra
septembra
(6)
►
augusta
augusta
(11)
►
júla
júla
(14)
►
júna
júna
(10)
►
mája
mája
(12)
►
apríla
apríla
(11)
►
marca
marca
(11)
►
februára
februára
(6)
►
januára
januára
(8)
▼
2019
2019
(145)
►
decembra
decembra
(16)
►
novembra
novembra
(12)
►
októbra
októbra
(10)
►
septembra
septembra
(13)
►
augusta
augusta
(12)
►
júla
júla
(6)
►
júna
júna
(9)
►
mája
mája
(18)
▼
apríla
apríla
(14)
Emulator 29.0.6 canary
ConstraintLayout 2.0.0 alpha 5
Emulator 29.0.5 Canary
Android Studio 3.5 Canary 13 available
Emulator 29.0.4 Canary
Emulator 29.0.3 Canary
Android Studio 3.5 Canary 12 available
Android Studio 3.4 available in the Stable channel
Android Studio 3.5 Canary 11 available
Emulator 29.0.2 Canary
Emulator 29.0.1 Canary
ConstraintLayout 2.0.0 alpha 4
Android Studio 3.5 Canary 10 available
Android Studio 3.4 Release Candidate 3 available
►
marca
marca
(12)
►
februára
februára
(10)
►
januára
januára
(13)
►
2018
2018
(128)
►
decembra
decembra
(13)
►
novembra
novembra
(12)
►
októbra
októbra
(10)
►
septembra
septembra
(10)
►
augusta
augusta
(16)
►
júla
júla
(10)
►
júna
júna
(13)
►
mája
mája
(9)
►
apríla
apríla
(11)
►
marca
marca
(12)
►
februára
februára
(9)
►
januára
januára
(3)
►
2017
2017
(48)
►
decembra
decembra
(3)
►
novembra
novembra
(2)
►
októbra
októbra
(8)
►
septembra
septembra
(3)
►
augusta
augusta
(4)
►
júla
júla
(3)
►
júna
júna
(3)
►
mája
mája
(4)
►
apríla
apríla
(5)
►
marca
marca
(5)
►
februára
februára
(6)
►
januára
januára
(2)
►
2016
2016
(5)
►
decembra
decembra
(3)
►
novembra
novembra
(2)
Subscribe to updates
Príspevky
Atom
Príspevky
Android Developers
Android Studio
Preview
Release Updates
ConstraintLayout 2.0.0 alpha 5
piatok 26. apríla 2019
We just released ConstraintLayout 2.0.0 alpha 5. It’s available from the google maven repository:
dependencies {
implementation 'com.android.support.constraint:constraint-layout:2.0.0-alpha5'
}
or if using the AndroidX packages:
dependencies {
implementation 'androidx.constraintlayout:constraintlayout:2.0.0-alpha5'
}
Documentation is available on
https://developer.android.com/reference/android/support/constraint/classes.html
Examples are available on
https://github.com/googlesamples/android-ConstraintLayoutExamples
Changes
This release contains various bug fixes and performance improvements:
ConstraintLayout
New:
Flow
virtual layout
MotionLayout
Various fixes (layout updates)
Auto transition (autoTransition)
Derived Constraints (deriveConstraintsFrom)
OnSwipe regions (touchRegionId)
MotionTarget matching (layout_constraintTag, motionTarget)
OnSwipe without automatically completing (autoComplete=”false”)
If OnClick has no target id the MotionLayout is targeted
Flow Virtual layout
Flow
is a virtual layout. It can be used within a ConstraintLayout and supports multiple ways of laying out the referenced widgets (create a single chain, or multiple chains to wrap around, or a table). The advantages of being a virtual layout compared to a normal viewgroups are that:
The layout hierarchy remains flat, simplifying runtime manipulations and animations
You can constrain the Flow widget as you would any other view.
You can constrain other views to views laid out by Flow.
Within MotionLayout you can animate views into and out of a flow virtual layout, change its orientation, etc.
Flow will lay out widgets either horizontally or vertically, depending on the value of the
android:orientation
attribute. The next important attribute to set is
flow_wrapMode
, which will control how the referenced widgets are laid out in the given orientation:
app:flow_wrapMode = “none”
will create a single chain out of the referenced elements (
default
)
app:flow_wrapMode = “chain”
will create multiple chains (one after the other) if the referenced elements do not fit in the available space
app:flow_wrapMode = “aligned”
is a bit similar to wrap chain, but will align the elements, basically creating rows and columns
The way elements are positioned for the other orientation is controlled by
flow_horizontalAlign
and
flow_verticalAlign
attributes. For example, if specifying a horizontal orientation, use
flow_verticalAlign
to control the vertical positioning of the elements being laid out.
android:orientation = “horizontal|vertical”
(default horizontal)
app:flow_horizontalStyle = "spread|spread_inside|packed"
(default spread)
app:flow_verticalStyle = "spread|spread_inside|packed"
(default spread)
app:flow_horizontalBias = "float"
(default 0.5)
app:flow_verticalBias = "float"
(default 0.5)
app:flow_horizontalGap = "dimension"
(default 0)
app:flow_verticalGap = "dimension"
(default 0)
app:flow_horizontalAlign = "start|end|center"
(default center)
app:flow_verticalAlign = "top|bottom|center|baseline”
(default center)
app:flow_maxElementsWrap = "integer"
(default : 0, not applied)
New features of MotionLayout
We also added several new features to MotionLayout.
Auto Transition
Transitions can be made to automatically fire when MotionLayout reaches a state associated with that transition.
none - default value no transitions automatically
animateToStart - animate to the start state if you are at the end state
animateToEnd - animate to the end state if you are at the start state
jumpToEnd - Jump to the start state if you are at the start state
jumpToStart - Jump to the end state if you are at the end state
These can be combined to allow jumping to the end but smooth transition to the start.
<
Transition
motion
:constraintSetStart
="@+id/end"
motion
:constraintSetEnd
="@+id/b"
motion
:autoTransition
="animateToEnd"
motion
:motionInterpolator
="easeIn"
motion
:duration
="1000"
/>
Derived Constraints
Constraint sets can now be derived from other constraints sets. This can greatly reduce xml size. In a <ConstraintSet> can now have an attribute deriveConstraintsFrom which allows you to specify the id of another constraint set. This is useful for generating a series of constraints that only have small variations between them.
Note:
A constraint set represents the complete set of constraints for a layout
This works well in conjunction with the newer PropertySet, Layout, Transform syntax
All ConstraintSets derive from from the MotionLayout by default
<!-- Content of layout file -->
<
ConstraintSet
android
:id
="@+id/base"
>
</
ConstraintSet
>
<!-- Layout file but override visibility of region1 (region1 now gone ) -->
<
ConstraintSet
android
:id
="@+id/state1"
>
<
Constraint
android
:id
="@id/region1"
>
<
PropertySet
motion
:visibility
="gone"
/>
</
Constraint
>
</
ConstraintSet
>
<!-- State1 (above) but override visibility of region2 (both region1 & region2 gone) -->
<
ConstraintSet
android
:id
="@+id/state2"
motion
:deriveConstraintsFrom
="@id/state1"
>
<
Constraint
android
:id
="@id/region2"
>
<
PropertySet
motion
:visibility
="gone"
/>
</
Constraint
>
</
ConstraintSet
>
OnSwipe regions
OnSwipe now takes an attribute touchRegionId which limits the starting point of the bounds of that view.
Note:
The
view pointed to by the id
can be invisible
Quite often the region is the same as the anchor.
This allows two Transition swipes to be in effect in the same direction normally each transition is in a different direction.
<
OnSwipe
motion
:dragDirection
="dragDown"
motion
:touchAnchorId
="@+id/region2"
motion
:touchRegionId
="@+id/region2"
motion
:touchAnchorSide
="top"
/>
Swipe without autocomplete
OnSwipe Automatically completes the transition choosing the direction and animating smoothly to a stop. Sometimes this feature is not desired and can be turned off.
You can use this to implement things like a custom slider.
<
OnSwipe
motion
:dragDirection
="dragRight"
motion
:autoComplete
="false"
motion
:touchAnchorId
="@+id/button"
motion
:touchAnchorSide
="right"
/>