Questions tagged [android-constraintlayout]

A new type of layout available in the Android Support repository built on top of a flexible constraint system, marking views positions relative to each other.

ConstraintLayout is new type of layout that you can use in your android app. It is new powerful and flexible Android layout that allows you to express complex UI without nesting multiple layouts.

It is available since Android Studio 2.2, part of the support library and compatible from API level 9 (Android 2.3 GINGERBREAD).

ConstraintLayout aims at improving performance of layouts by reducing layout hierarchies and reduce the complexity of trying to work with RelativeLayout.

ConstraintLayout is compatible with other layout types such as RecyclerView, LinearLayout.

There are currently various types of constraints that you can use:

Relative positioning Margins Centering positioning Circular positioning Visibility behavior Dimension constraints Chains Virtual Helpers objects Optimizer

For more information about ConstraintLayout - Build a Responsive UI with ConstraintLayout

3207 questions
23
votes
3 answers

ConstraintLayout Problems using

I am trying to figure out why this does not work. I am adding nothing but two sections in a ConstraintLayout and the layout is not following any of the constraints that I set up. I am trying to begin migrating to the use of…
Mike
  • 515
  • 6
  • 14
22
votes
6 answers

Travis CI build doesn't work with Android Constraint Layout

I am trying to make Travis build my Android project. It fails when it tries to download the library for ConstraintLayout. Do you know what I have to do to make it work? My .travis.yml is this: language: android jdk: - oraclejdk8 android: …
Terry
  • 14,529
  • 13
  • 63
  • 88
21
votes
1 answer

What is 'Vertical Bias' or 'Horizontal Bias' used for in Android's 'ConstraintLayout'?

I am quite new to Android development and today I wondered what the 'Vertical Bias' respectively the 'Horizontal Bias' is used for in the 'ConstraintLayout'.
Chris
  • 2,071
  • 4
  • 14
  • 22
21
votes
3 answers

ConstraintLayout onMeasure very slow

so I tried refactoring some of my recycler ViewHolders to ConstraintLayouts. After I did it I was shocked after what I saw. Inflating a single view takes 20x more time than usual LinearLayout. It actually skips so many frames while doing it. EDIT:…
21
votes
5 answers

Android ConstraintLayout TextView go off the screen

As you see in the picture the text is off the wall. This is such a bizarre behavior and I think it´s a bug Here´s a screen shoot: Here´s the header xml:
Erik
  • 5,039
  • 10
  • 63
  • 119
21
votes
5 answers

ConstraintLayout - avoid overlapping

There is a ConstraintLayout layout:
ilw
  • 2,499
  • 5
  • 30
  • 54
21
votes
6 answers

Android Studio 3 - Constraint layout editor broken

I'm using Android Studio 3.0 (updated to canary 4 today) on macOS for a side project and recently (not sure really when) the constraint layout editor stopped working properly. Now it just shows a grey window and the blueprint view isn't working at…
Benoit
  • 1,168
  • 8
  • 16
20
votes
1 answer

What is ConstraintLayout Optimizer?

Google published ConstraintLayout 1.1.0 beta 6 on March 22, 2018. It has a new constraint known as Optimizer. The documentation of Optimizer at https://developer.android.com/reference/android/support/constraint/ConstraintLayout.html#Optimizer does…
Monish Kamble
  • 1,478
  • 1
  • 15
  • 28
20
votes
3 answers

View with minHeight in ConstraintLayout

I have a ConstraintLayout inside a NestedScrollView. The ConstraintLayout contains a bunch of views but the last View can have a dynamic height to fill up the bottom space if there is any but it also needs to be a minimum height if there is not…
StuStirling
  • 15,601
  • 23
  • 93
  • 150
20
votes
5 answers

Android - ConstraintLayout - ellipsize end for large text

I need some help regarding an Android layout. I have the following code:
Cosmin Mihu
  • 264
  • 1
  • 3
  • 9
20
votes
2 answers

Align ConstraintLayout item to be at the end of two items

I have a ConstraintLayout with two views A and B that are stacked vertically. I have a third view C which needs to be to the end of both A and B horizontally. At any given point, A may be wider than B or vice versa, so the constraint cannot only be…
Allan W
  • 2,791
  • 4
  • 23
  • 41
20
votes
6 answers

Remove padding in horizontal progress bar

In our application we need an indeterminate progress bar, like so: We can achieve this by setting a negative margin on the ProgressBar, like this:
mreichelt
  • 12,359
  • 6
  • 56
  • 70
19
votes
6 answers

View overlapping with Toolbar using ConstraintLayout

I'm having an issue of an overlapping ListView with a compat Toolbar using the ConstraintLayout All i want to do is have a toolbar and then in the rest of the space have a listview. Pretty simple This is my…
Hilikus
  • 9,954
  • 14
  • 65
  • 118
19
votes
2 answers

How do margins in chains work in ConstraintLayout 1.1.0 (beta)

I have had a couple of my layouts blow up since changing over to ConstraintLayout version 1.1.0-beta4. Before I make any changes, I want to get a better understanding of how margins work in ConstraintLayout chains. In the following, I compare a…
Cheticamp
  • 61,413
  • 10
  • 78
  • 131
18
votes
3 answers

Constraint layout Issue java.lang.AssertionError: TOP

I started using Constraint Layout, I facing Assertion Error while compiling the design file alone this issue will occur. What is the right way to fix this issue? I mess up with hole day. Here is my XML design.
MohanRaj S
  • 1,958
  • 4
  • 30
  • 54