# constraintlayout

Published articles for constraintlayout.

This is one page of public article previews, not the complete archive. Follow Next page to continue. Summaries are not the original full articles.

## CatGPT - or How to Position Elements on Overlays

DevFeed: [CatGPT - or How to Position Elements on Overlays](<https://devfeed.tech/articles/catgpt-or-how-to-position-elements-on-overlays-38464.md>)

Original publisher: [Read original article](<https://eevis.codes/blog/2023-10-22/catgpt-or-how-to-position-elements-on-overlays/>)

Author: Eevis Panula

Published: 2023-10-22T06:55:09.601000Z

Content type: tutorial

Language: en

Sources: [Eevis Blog](<https://devfeed.tech/sources/eevis-blog.md>)

Topics: [constraintlayout](<https://devfeed.tech/topics/constraintlayout.md>), [Kotlin](<https://devfeed.tech/topics/kotlin.md>), [Code](<https://devfeed.tech/topics/code.md>)

Tags: [code](<https://devfeed.tech/tags/code.md>), [constraintlayout](<https://devfeed.tech/tags/constraintlayout.md>), [how-to](<https://devfeed.tech/tags/how-to.md>), [kotlin](<https://devfeed.tech/tags/kotlin.md>), [ui-components](<https://devfeed.tech/tags/ui-components.md>)

### AI overview

A tutorial showing how to position a reaction element as an overlay on a message in a Kotlin chat client. It demonstrates using a ConstraintLayout, references, and modifiers to anchor the reaction in the message component.

### Source excerpt

Have you ever wondered how to display an element with an overlay while keeping it in the same position? The same way that, for example, many messaging apps highlight the message you want to react to. I had this type of challenge in one of my work projects. It took some trial and error to get it working, but I was so proud of myself when I finally found the correct modifiers (and numbers). I want to share one way to do it with you in this blog post. The Example App Okay, I must say that I maybe, just maybe, got a little bit carried away with this example app. But it's a CatGPT - a chat client where you can ask anything from a cat. Here's a short video: This app is simple; It doesn't use any third-party APIs, so the cat in question lives in the code. The app has one Room database, where it stores messages, and it has one screen called ChatScreen which displays messages. If you want to see the code, the starting point for the app is in the starting-point-branch, and the final code is in CatGPT-repository's main-branch. Showing Reaction with Message To simplify this app, each message can have only one reaction. In the Message data class, the reaction is already present: // data/Message.kt @Entity data class Message( @PrimaryKey(autoGenerate = true) val id: Long = 0, val text: String = "", val sender: Sender = Sender.ME, @TypeConverters(ReactionConverter::class) val reaction: Reaction? = null, ) And it's a nullable Reaction-enum. The complete code and converters for Reaction are in Message.kt. Let's first add code for showing that reaction before building the actual reaction picker. In the MessageRow.kt-file, there is already a ConstraintLayout, which contains the component for the message. We want to show the reaction in the bottom right corner of that component, so we'll add the reaction inside the constraint layout. The component for reaction looks like this: // ui/components/MessageRow.kt message.reaction?.let { Text( modifier = Modifier .clip(ChatScreen.shape) .back

## Using MotionLayout in Compose

DevFeed: [Using MotionLayout in Compose](<https://devfeed.tech/articles/using-motionlayout-in-compose-22662.md>)

Original publisher: [Read original article](<https://www.valueof.io/blog/motionlayout-in-compose-motion-scene-json5>)

Author: James Shvarts

Published: 2022-05-05T11:52:55Z

Content type: tutorial

Language: en

Sources: [Android Blog - Mobile Dev Notes](<https://devfeed.tech/sources/android-blog-mobile-dev-notes.md>)

Topics: [Jetpack Compose](<https://devfeed.tech/topics/jetpack-compose.md>), [Compose](<https://devfeed.tech/topics/compose.md>), [Android](<https://devfeed.tech/topics/android.md>), [android-development](<https://devfeed.tech/topics/android-development.md>), [Framework](<https://devfeed.tech/topics/framework.md>)

Tags: [android](<https://devfeed.tech/tags/android.md>), [android-development](<https://devfeed.tech/tags/android-development.md>), [animation](<https://devfeed.tech/tags/animation.md>), [compose](<https://devfeed.tech/tags/compose.md>), [constraintlayout](<https://devfeed.tech/tags/constraintlayout.md>), [dependency](<https://devfeed.tech/tags/dependency.md>), [experimental](<https://devfeed.tech/tags/experimental.md>), [jetpack](<https://devfeed.tech/tags/jetpack.md>), [jetpack-compose](<https://devfeed.tech/tags/jetpack-compose.md>), [motionlayout](<https://devfeed.tech/tags/motionlayout.md>)

### AI overview

This tutorial demonstrates MotionLayout in Jetpack Compose, using a JSON5 motion scene to define constraints and animate widgets such as a divider and an image. It also shows how to control animation progress with a composable and slider.

### Source excerpt

A demo of using MotionLayout with Jetpack Compose with motion scene set up as a JSON5

## Controlling TextView MinWidth

DevFeed: [Controlling TextView MinWidth](<https://devfeed.tech/articles/controlling-textview-minwidth-38652.md>)

Original publisher: [Read original article](<https://krossovochkin.com/posts/2021_09_14_controlling_textview_minwidth/>)

Published: 2021-09-14T00:00:00Z

Content type: tutorial

Language: en

Sources: [Vasya Drobushkov](<https://devfeed.tech/sources/vasya-drobushkov.md>)

Topics: [Android](<https://devfeed.tech/topics/android.md>), [constraintlayout](<https://devfeed.tech/topics/constraintlayout.md>), [Code](<https://devfeed.tech/topics/code.md>)

Tags: [android](<https://devfeed.tech/tags/android.md>), [android-layout](<https://devfeed.tech/tags/android-layout.md>), [background](<https://devfeed.tech/tags/background.md>), [constraintlayout](<https://devfeed.tech/tags/constraintlayout.md>), [gravity](<https://devfeed.tech/tags/gravity.md>), [layout](<https://devfeed.tech/tags/layout.md>), [properties](<https://devfeed.tech/tags/properties.md>), [textview](<https://devfeed.tech/tags/textview.md>), [xml](<https://devfeed.tech/tags/xml.md>)

### AI overview

A technical explanation of how Android TextView minimum-width APIs interact. Setting minWidth or minimumWidth alone may not reset a dimension declared in XML; both properties must be cleared, and a background can still impose a minimum width.

### Source excerpt

Introduction Sometimes we might need our TextView with wrap_content width to occupy more space than it will based on amount of characters it displays. For that we can set minimum width. Usually, we do that via XML like this: <?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"> <TextView android:id="@+id/textView" android:layout_width="wrap_content" android:layout_height="wrap_content" android:background="@drawable/bg_text" android:gravity="center" android:minWidth="200dp" android:text="Hello World!" app:layout_constraintBottom_toBottomOf="parent" app:layout_constraintLeft_toLeftOf="parent" app:layout_constraintRight_toRightOf="parent" app:layout_constraintTop_toTopOf="parent" /> </androidx.constraintlayout.widget.ConstraintLayout> Having setup like this we ensure that our TextView will occupy a minimum of 200dp. Also, we can control minimum width programmatically via: TextView#setMinWidth. But controlling minimum width programmatically has one caveat that I'd like to describe below.

## First Impressions of Android's new ConstraintLayout

DevFeed: [First Impressions of Android's new ConstraintLayout](<https://devfeed.tech/articles/first-impressions-of-android-s-new-constraintlayout-41662.md>)

Original publisher: [Read original article](<http://mikewolfson.com/blog/2021/9/8/first-impressions-of-androids-new-constraintlayout>)

Author: Mike Wolfson

Published: 2021-09-08T15:57:48Z

Content type: opinion

Language: en

Sources: [My Big Appetite - Mike Wolfson](<https://devfeed.tech/sources/my-big-appetite-mike-wolfson.md>)

Topics: [Android](<https://devfeed.tech/topics/android.md>), [constraintlayout](<https://devfeed.tech/topics/constraintlayout.md>), [layout](<https://devfeed.tech/topics/layout.md>), [Android Studio](<https://devfeed.tech/topics/android-studio.md>), [ui](<https://devfeed.tech/topics/ui.md>), [XML](<https://devfeed.tech/topics/xml.md>)

Tags: [android](<https://devfeed.tech/tags/android.md>), [android-layout](<https://devfeed.tech/tags/android-layout.md>), [android-studio](<https://devfeed.tech/tags/android-studio.md>), [androiddev](<https://devfeed.tech/tags/androiddev.md>), [constraintlayout](<https://devfeed.tech/tags/constraintlayout.md>), [gde](<https://devfeed.tech/tags/gde.md>), [jank](<https://devfeed.tech/tags/jank.md>), [layout](<https://devfeed.tech/tags/layout.md>), [render](<https://devfeed.tech/tags/render.md>), [responsive](<https://devfeed.tech/tags/responsive.md>), [ui](<https://devfeed.tech/tags/ui.md>), [xml](<https://devfeed.tech/tags/xml.md>)

### AI overview

An early review of Android's ConstraintLayout, introduced at Google I/O 2016. It describes the XML-based layout container, its constraint-driven responsive design, Android Studio's visual editor, and its goal of producing flatter view hierarchies for faster rendering and less visual jank.

### Source excerpt

This article was originally published to Medium on May 31, 2016 - 4 min read After Google IO, the Android GDE team got together to gather our thoughts about the most significant announcements from the conference. This is a summary of our thoughts about the new ConstraintLayout. Some of the Andoid GDEs at post-IO gathering At IO 2016, one of the more exciting announcements (especially for UI focused developers) was a new layout container and tool named ConstraintLayout (CL). It's early days for this tool. It is currently only available from the Canary channel of Android Studio. We expect it to mature quickly (they have already pushed their first update within the first week of release). We expect that eventually this layout type will be the default used for all top-level interfaces. ConstraintLayout View Type High-level Constraint Layout basic concepts On a basic level, the new CL is just another simple XML layout type. It is not much different then other layouts you are probably already using (like RelativeLayout or LinearLayout). In fact, the CL can be used just like any other layout -- it can be nested into other layouts, and even be used back to API 9. It is possible to view and edit the XML, but when we asked Googlers about this, they all answered: "You can, but why would you want to?". This is primarily designed as a visually oriented tool. The new layout is based on Constraints. These describe relationships between your views (or the screen), in a responsive nature. These attributes are very similar to the ones used with RelativeLayout (such as: android:layout_alignParentBottom="true"). If CL was just another layout container, there wouldn't be too much to be excited about. But, CL is much more then just another layout type. It is an all new layout container designed to help developers create complex layouts that are optimized to render quickly. This is because it generates flat view hierarchies (read this article to review why this is important). This will rea

## Expandable lists in Jetpack Compose

DevFeed: [Expandable lists in Jetpack Compose](<https://devfeed.tech/articles/expandable-lists-in-jetpack-compose-25896.md>)

Original publisher: [Read original article](<https://proandroiddev.com/expandable-lists-in-jetpack-compose-b0b78c767b4?source=rss-56174fa84bcc------2>)

Author: Denys Rudenko

Published: 2021-01-11T18:21:04Z

Content type: tutorial

Language: en

Sources: [Stories by Denis Rudenko on Medium](<https://devfeed.tech/sources/stories-by-denis-rudenko-on-medium.md>)

Topics: [Jetpack Compose](<https://devfeed.tech/topics/jetpack-compose.md>), [ui](<https://devfeed.tech/topics/ui.md>), [Data structures](<https://devfeed.tech/topics/data-structures.md>)

Tags: [android](<https://devfeed.tech/tags/android.md>), [compose](<https://devfeed.tech/tags/compose.md>), [constraintlayout](<https://devfeed.tech/tags/constraintlayout.md>), [coroutine](<https://devfeed.tech/tags/coroutine.md>), [data-class](<https://devfeed.tech/tags/data-class.md>), [expandable-animation](<https://devfeed.tech/tags/expandable-animation.md>), [expandable-list](<https://devfeed.tech/tags/expandable-list.md>), [expandable-view](<https://devfeed.tech/tags/expandable-view.md>), [jetpack-compose](<https://devfeed.tech/tags/jetpack-compose.md>), [layout](<https://devfeed.tech/tags/layout.md>), [lifecycle](<https://devfeed.tech/tags/lifecycle.md>), [memory](<https://devfeed.tech/tags/memory.md>), [state](<https://devfeed.tech/tags/state.md>), [stateflow](<https://devfeed.tech/tags/stateflow.md>), [viewmodel](<https://devfeed.tech/tags/viewmodel.md>)

### AI overview

A tutorial explains how to build expandable lists in Jetpack Compose. It uses a card data class, a view model with StateFlow for cards and expanded card IDs, composable functions that observe state, and transition state to animate card expansion.

### Source excerpt

Expandable views are a common way to hide details of a visualised data structures. Let's take a look at how the following can be achieved in 6 steps, using compose: https://medium.com/media/b9dface7145a04eb3bee8ac03eed3a4e/hrefStep 1: Creating a data class for carddata class ExpandableCardModel(val id: Int, val title: String)Step 2: Create a data source We'll be using AAC viewModel example here, but feel free to use any "controller" abstraction you like. https://medium.com/media/61d179f82414c569e4d8e415bbed8aa6/href This class serves 4 purposes: Holds list of cards using MutableStateFlow in _cards field, and exposes a StateFlow to observers via cards field. Holds list of expanded card ids in _expandedCardIdsList, and exposes them to observers via expandedCardIdsList field. Provides list of cards using getFakeData() function. We need a coroutine here, to emit the testList into _cards. Contains a onCardArrowClicked() to mark cards as expanded by adding tapped card id to _expandedCardIdsList, and notify observers about this change by mutating the state of _expandedCardIdsList. Step 3: MainActivityhttps://medium.com/media/6e10348f08fc4004c3a397cd46c19bd0/href We are initialising the CardsViewModel here, and providing it to the CardsScreen composable function. Step 4: CardsScreen composablehttps://medium.com/media/b2cd50c3ab379cd75897eda6b1aca4c6/href We are observing the viewModel.cards containing our list of cards, and viewModel.expandedCardIds with the help of .collectAsState(). What's the purpose of .collectAsState()? It's converting StateFlow into a State. Update: using .collectAsStateWithLifecycle() which is the same thing, but lifecycle aware, and helps to reduce memory consumption when UI is not visible to the user. More info in this article. What's a State? From the documentation: " State is a value holder where reads to the value property during the execution of a composable function, the current recomposeScope will be subscribed to changes of that value." Step

## Learn Jetpack Compose for Android by Examples

DevFeed: [Learn Jetpack Compose for Android by Examples](<https://devfeed.tech/articles/learn-jetpack-compose-for-android-by-examples-22874.md>)

Original publisher: [Read original article](<https://medium.com/mindorks/learn-jetpack-compose-for-android-by-examples-a1461f6388a?source=rss----f1a763fc7443---4>)

Author: Amit Shekhar

Published: 2020-11-02T05:02:09Z

Content type: tutorial

Language: en

Sources: [Mindorks - Medium](<https://devfeed.tech/sources/mindorks-medium.md>)

Topics: [Jetpack Compose](<https://devfeed.tech/topics/jetpack-compose.md>), [Tutorial](<https://devfeed.tech/topics/tutorial.md>), [Android](<https://devfeed.tech/topics/android.md>), [Jetpack](<https://devfeed.tech/topics/jetpack.md>), [ui](<https://devfeed.tech/topics/ui.md>), [Android Studio](<https://devfeed.tech/topics/android-studio.md>), [Material Design](<https://devfeed.tech/topics/material-design.md>)

Tags: [android](<https://devfeed.tech/tags/android.md>), [android-studio](<https://devfeed.tech/tags/android-studio.md>), [androiddev](<https://devfeed.tech/tags/androiddev.md>), [animation](<https://devfeed.tech/tags/animation.md>), [compose](<https://devfeed.tech/tags/compose.md>), [constraintlayout](<https://devfeed.tech/tags/constraintlayout.md>), [jetpack](<https://devfeed.tech/tags/jetpack.md>), [jetpack-compose](<https://devfeed.tech/tags/jetpack-compose.md>), [kotlin](<https://devfeed.tech/tags/kotlin.md>), [material-design](<https://devfeed.tech/tags/material-design.md>), [tutorial](<https://devfeed.tech/tags/tutorial.md>), [ui](<https://devfeed.tech/tags/ui.md>)

### AI overview

This tutorial introduces an open-source project for learning Jetpack Compose for Android through examples. It covers building native UI, styling text and text fields, using previews and layouts, handling interactions, adding common Material Design components, creating custom views, and applying animations.

### Source excerpt

Hi, We just open-sourced a project to learn Jetpack Compose for Android by Examples. Jetpack Compose is Android's modern toolkit for building native UI. Project Link: Jetpack-Compose-Android-Examples You will be learning: How to build UI using Jetpack Compose in Android? How to display a Text and apply various styles to a Text? How to display a TextField(EditText) and apply various styles on it? How to use the Preview and PreviewParameter feature offered by Android Studio? Learn how to use various layouts such as Column, ScrollableColumn, LazyColumn, Row, ScrollableRow, Box, Stack, and ConstraintLayout in Jetpack Compose? Learn the usage of Clickable in Jetpack Compose with the help of examples. How to use Buttons, Card, Images, AlertDialog in Jetpack Compose? Through the Jetpack Compose tutorial, you will learn various Material Design UI elements such as BottomAppBar, TopAppBar, BottomNavigation, Checkbox, CircularProgressIndicator, LinearProgressIndicator, RadioButton, Slider, Snackbar, and Switch. Learn how to make Custom Views in Jetpack Compose? How to add animation such as Crossfade and Shape Rotation in Jetpack Compose? Project Link: Jetpack-Compose-Android-Examples Thanks Team MindOrks Learn Jetpack Compose for Android by Examples was originally published in MindOrks on Medium, where people are continuing the conversation by highlighting and responding to this story.

## Fingerprint Authentication Tutorial

DevFeed: [Fingerprint Authentication Tutorial](<https://devfeed.tech/articles/fingerprint-authentication-tutorial-22807.md>)

Original publisher: [Read original article](<http://androidessence.com/fingerprint-authentication-tutorial/>)

Author: Adam McNeilly

Published: 2018-01-02T00:00:00Z

Content type: tutorial

Language: en

Sources: [Android Essence](<https://devfeed.tech/sources/android-essence.md>)

Topics: [Tutorial](<https://devfeed.tech/topics/tutorial.md>), [Authentication](<https://devfeed.tech/topics/authentication.md>), [Android](<https://devfeed.tech/topics/android.md>), [Material Design](<https://devfeed.tech/topics/material-design.md>), [XML](<https://devfeed.tech/topics/xml.md>), [Code](<https://devfeed.tech/topics/code.md>)

Tags: [android](<https://devfeed.tech/tags/android.md>), [authentication](<https://devfeed.tech/tags/authentication.md>), [code](<https://devfeed.tech/tags/code.md>), [constraintlayout](<https://devfeed.tech/tags/constraintlayout.md>), [dialog](<https://devfeed.tech/tags/dialog.md>), [material-design](<https://devfeed.tech/tags/material-design.md>), [tutorial](<https://devfeed.tech/tags/tutorial.md>), [xml](<https://devfeed.tech/tags/xml.md>)

### AI overview

A step-by-step tutorial for integrating a fingerprint authentication dialog into an Android application. It covers the Material Design guidance for the dialog, an XML ConstraintLayout implementation, and a helper controller using FingerprintManagerCompat to support older Android versions.

### Source excerpt

When Android released version 6.0 Marshmallow (yes, a little outdated at this point), a whole slew of new developer APIs came with it. One that I've personally enjoyed as a consumer is fingerprint authentication. I skimmed over the official docs, and even through their Fingerprint Dialog Sample but had a difficult time following what was going on. Eventually, though, I was able to recreate the flow. This post is going to be a step by step guide to integrating your own fingerprint dialog in your Android application.

## Android's ConstraintLayout: Align One View's Edge to Another View's Center

DevFeed: [Android's ConstraintLayout: Align One View's Edge to Another View's Center](<https://devfeed.tech/articles/android-s-constraintlayout-align-one-view-s-edge-to-another-view-s-center-29111.md>)

Original publisher: [Read original article](<https://www.grokkingandroid.com/align-one-views-edge-to-another-views-center-in-constraintlayout/>)

Author: Wolfram Rittmeyer

Published: 2016-08-30T07:20:07Z

Content type: tutorial

Language: en

Sources: [Grokking Android](<https://devfeed.tech/sources/grokking-android.md>)

Topics: [constraintlayout](<https://devfeed.tech/topics/constraintlayout.md>), [Android](<https://devfeed.tech/topics/android.md>)

Tags: [android](<https://devfeed.tech/tags/android.md>), [constraintlayout](<https://devfeed.tech/tags/constraintlayout.md>), [layout](<https://devfeed.tech/tags/layout.md>)

### AI overview

A tutorial explains how to align one Android view's edge with the center of another in ConstraintLayout when no direct constraint attribute is available. It uses a centered, invisible helper view and aligns the second view to that helper.

### Source excerpt

As you can see from the following excerpt of ConstraintLayout's supported attributes, there is no layout_constraintStart_toCenterX attribute. Thus you cannot directly align the left edge of one view to the center of another view. But ConstraintLayout is flexible enough to get your view aligned to the center of another view without such an attribute. Even [...] Continue Reading "Android's ConstraintLayout: Align One View's Edge to Another View's Center" The post Android's ConstraintLayout: Align One View's Edge to Another View's Center appeared first on Grokking Android.

## Some Thoughts on Android's new ConstraintLayout and Android Studio's new Design Editor

DevFeed: [Some Thoughts on Android's new ConstraintLayout and Android Studio's new Design Editor](<https://devfeed.tech/articles/some-thoughts-on-android-s-new-constraintlayout-and-android-studio-s-new-design-editor-29125.md>)

Original publisher: [Read original article](<https://www.grokkingandroid.com/thoughts-on-constraintlayout-and-design-editor/>)

Author: Wolfram Rittmeyer

Published: 2016-07-06T06:10:42Z

Content type: opinion

Language: en

Sources: [Grokking Android](<https://devfeed.tech/sources/grokking-android.md>)

Topics: [constraintlayout](<https://devfeed.tech/topics/constraintlayout.md>), [Android Studio](<https://devfeed.tech/topics/android-studio.md>), [Android](<https://devfeed.tech/topics/android.md>)

Tags: [android](<https://devfeed.tech/tags/android.md>), [android-studio](<https://devfeed.tech/tags/android-studio.md>), [constraintlayout](<https://devfeed.tech/tags/constraintlayout.md>), [layout](<https://devfeed.tech/tags/layout.md>), [layout-editor](<https://devfeed.tech/tags/layout-editor.md>), [work](<https://devfeed.tech/tags/work.md>)

### AI overview

An opinion article examines Android's ConstraintLayout and Android Studio's redesigned Design Editor. It highlights easier handling of complex screen designs, stretched child dimensions, guidelines, and the intended performance improvements, while noting that the layout was still in alpha and required further work.

### Source excerpt

At this year's IO Google introduced a new layout - the ConstraintLayout - and also presented it's totally revamped layout editor. I am not going into how to use the layout. Google itself has done a good job in explaining it with its code lab "Using ConstraintLayout to design your views". In this post I [...] Continue Reading "Some Thoughts on Android's new ConstraintLayout and Android Studio's new Design Editor" The post Some Thoughts on Android's new ConstraintLayout and Android Studio's new Design Editor appeared first on Grokking Android.

## Intro to the new ConstraintLayout in Android

DevFeed: [Intro to the new ConstraintLayout in Android](<https://devfeed.tech/articles/intro-to-the-new-constraintlayout-in-android-25833.md>)

Original publisher: [Read original article](<https://segunfamisa.com/posts/constraint-layout-in-android>)

Author: Segun Famisa

Published: 2016-05-30T11:05:30Z

Content type: tutorial

Language: en

Sources: [Segun Famisa](<https://devfeed.tech/sources/segun-famisa.md>)

Topics: [Android Studio](<https://devfeed.tech/topics/android-studio.md>), [Android](<https://devfeed.tech/topics/android.md>), [ui](<https://devfeed.tech/topics/ui.md>)

Tags: [android](<https://devfeed.tech/tags/android.md>), [android-studio](<https://devfeed.tech/tags/android-studio.md>), [constraintlayout](<https://devfeed.tech/tags/constraintlayout.md>), [guide](<https://devfeed.tech/tags/guide.md>), [layout](<https://devfeed.tech/tags/layout.md>), [ui](<https://devfeed.tech/tags/ui.md>)

### AI overview

This tutorial introduces Android's ConstraintLayout and the associated layout editor in Android Studio 2.2 Preview. It explains how constraints position views relative to other views, layout edges, or guidelines, and describes resize, side, and baseline handles. It also outlines setup requirements and initial ways to create a ConstraintLayout.

### Source excerpt

Last week, also during the Google I/O conference, Google introduced a new set of tools for Android developers. Among them is a new Layout editor and a new layout called the ConstraintLayout. The ConstraintLayout was said to be a new tool to empower developers create very flat ui-hierarchies for their complex layout. I've been playing around and exploring the new thing and I'll summarize my findings in this post. To be able to access these new features, you need to be running Android Studio 2.2 Preview and Java 8. You can head over to the canary channel to download it. Be sure to run it in parallel with your stable version. It's still in Preview! Layout Editor & Constraints Overview. The new layout editor in Android Studio 2.2 Preview is specially built for the ConstraintLayout. You can specify the constraints manually, or automatically reference within the layout editor. Overview of Constraints? A constraint is the description of how a view should be positioned relative to other items, in a layout. A constraint is typically defined for one or more sides by connecting the view to: An anchor point, or another view, An edge of the layout, Or An invisible guide line. Since each view within the layout is defined by associations to other views within the layout, it's easier to achieve flat hierarchy for complex layouts. In principle, the ConstraintLayout works very similar to the RelativeLayout, but uses various handles (or say anchors) for the constraints. (Source) Resize handle. The resize handle is the seen in the corners of the figure above, and it's used to resize the view. Side handle. The side handle is the in the figure above, and it's used to specify the location of a widget. E.g using the left side handle to always be aligned to the right of another view, or the left of the ConstraintLayout itself. Baseline handle. The baseline handle is the in the figure above. It is used to align the text of a view by the baseline of the text on another view. Getting started w