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
1
vote
1 answer

ConstraintLayout: Set a Start constraint to the End of the longer View, only in XML?

In order to avoid using several nested layouts, I'm making use of a ConstraintLayout. I have 2 TextView, A and B. A is on top of B. A and B contain some text that is defined by the user. So A can be shorter than B, and B can be shorter than A, at…
JarsOfJam-Scheduler
  • 2,809
  • 3
  • 31
  • 70
1
vote
0 answers

What happens with the constraints after rotating the view?

What happens with the constraints after rotating the view? I'm trying to fit container(question_container) to center of screen, but this container must be able to rotate. After rotating constraints is not work. Screen before rotating: Screen after…
1
vote
1 answer

How can I set ListView's scroll in NestedScroll, ConstraintLayout?

I added my items on the ListView. I can use NestedScroll's scroll but I can't show my listView's items, I can only show 3 one. I want to a design like Twitter profile page
1
vote
1 answer

Custom ConstraintLayout class can't seem to lay things out horizontally - Android - Kotlin

I am trying to subclass ConstraintLayout to build a dynamic menu that I can pass in items and it will build a View with sub-views set up. I seem to be struggling with, in Kotlin, laying out things horizontally I've tried a few things, I've tried…
1
vote
1 answer

Show a part of the image in Parent layout

I want to design a layout where a part of the image should be visible in the layout. I am using Constraint Layout.I want to design the image provided.I have the green round image available with me.
1
vote
2 answers

How to set Android ListView's cell height as half of cell width?

I am trying to use constraint layout as below. But the aspect ratio is not respected in the actual layout. Instead, the height is actually wrapping the content inside
modeller
  • 3,770
  • 3
  • 25
  • 49
1
vote
1 answer

ConstraintSet.createHorizontalChain IllegalArgumentException: must have 2 or more widgets in a chain

I'm facing an error while setting a horizontal chain constrain using ConstraintLayout: E/AndroidRuntime: FATAL EXCEPTION: main Process: me.optimize.debug, PID: 18532 java.lang.RuntimeException: Unable to start activity…
ricardopereira
  • 11,118
  • 5
  • 63
  • 81
1
vote
2 answers

Grouping buttons with ConstraintLayout

I can't make a group of buttons visible or invisible. Target is that when clicking on one of the buttons, a group goes invisible and the next group of buttons becomes visible. Using migration to androidX.
1
vote
1 answer

Motion layout(alpha4) issue with recyclerview onswipe item

I am using alpha4 implementation 'androidx.constraintlayout:constraintlayout:2.0.0-alpha4' of constraint layout. First I created a single layout and do onswipe animation it is working perfectly with motion layout then I patched the layout with a…
Subho
  • 539
  • 1
  • 9
  • 25
1
vote
2 answers

Android: Keep ratio for a full-width and undefined height ImageView in a ConstraintLayout?

In a ConstraintLayout, an ImageView is bound to its parent in such a way that: Its left side is bound to the screen's left side Its right side is bound to the screen's right side Its top side is bound to a widget's bottom side Its bottom side is…
1
vote
2 answers

TextView above ImageView: Space between the top of the scaled SVG and the bottom of the TextView is scaled

In my application, a TextView is shown above an ImageView which contains a SVG image. Depending on the screen resolution, the ImageView, which is constrained (top and bottom e.g.) by another ImageView, is scaled: thus its SVG is also scaled by…
JarsOfJam-Scheduler
  • 2,809
  • 3
  • 31
  • 70
1
vote
1 answer

how to center a view in a constraint layout 1.0

I have a view (FrameLayout) in a constraintLayout For tablet devices (only) I want to have this configuration 1) its max height to say 100dp 2) It has to be wrap content 3) It has to be centered in its parent (vertically and horizontally). I'm…
Elad Benda
  • 35,076
  • 87
  • 265
  • 471
1
vote
2 answers

Android constraint layout changes it's appearance in Mobile

Layout is looking awesome but not in Mobile. How to overcome it!!! tried to connect each view to parent separately, watched some tutorials to resolve the issue but it was not resolving the issue.I tried to connect each view with parent but it didn't…
1
vote
0 answers

'This view is not constrained.' error though view is constrained with circular positioning in android-constraintlayout

I am using constraintlayout's circular positioning in my layout. But Android Studio IDE shows me this error. My center item:
Rasel
  • 5,488
  • 3
  • 30
  • 39
1
vote
1 answer

ConstraintLayout with custom views as item in a recycler

It seems that a ConstraintLayout is an improved version of a RelativeLayout. I was wondering, if I have custom views (let's say linear layouts but not too nested) is it a bad practice to use a ConstraintLayout and show these custom views positioned…
1 2 3
99
100