1Answer
  • 8
name

A PHP Error was encountered

Severity: Notice

Message: Undefined index: userid

Filename: views/question.php

Line Number: 191

Backtrace:

File: /home/prodcxja/public_html/questions/application/views/question.php
Line: 191
Function: _error_handler

File: /home/prodcxja/public_html/questions/application/controllers/Questions.php
Line: 433
Function: view

File: /home/prodcxja/public_html/questions/index.php
Line: 315
Function: require_once

name Punditsdkoslkdosdkoskdo

Reason for Barrier not moving

I'd like to make a layout that looks like this, but using Barriers: expected layout

So I made the following XML:

<?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"
    android:layout_width="match_parent"
    android:layout_height="match_parent">

    <Button
        android:id="@+id/buttonA"
        android:layout_width="wrap_content"
        android:layout_height="wrap_content"
        android:text="A"
        app:layout_constraintStart_toStartOf="parent"
        app:layout_constraintTop_toTopOf="parent" />

    <Button
        android:id="@+id/buttonB"
        android:layout_width="wrap_content"
        android:layout_height="wrap_content"
        android:text="B"
        app:layout_constraintEnd_toEndOf="parent"
        app:layout_constraintTop_toTopOf="parent" />

    <androidx.constraintlayout.widget.Barrier
        android:id="@+id/barrier"
        android:layout_width="wrap_content"
        android:layout_height="wrap_content"
        app:barrierDirection="bottom"
        app:constraint_referenced_ids="buttonA,buttonB" />

    <Button
        android:layout_width="0dp"
        android:layout_height="wrap_content"
        android:text="C"
        app:layout_constraintEnd_toEndOf="parent"
        app:layout_constraintStart_toStartOf="parent"
        app:layout_constraintTop_toBottomOf="@id/barrier" />

</androidx.constraintlayout.widget.ConstraintLayout>

But the result looks like this:

actual layout

It seems like the Barrier doesn't move downwards. What am I doing wrong?

    • Everything seems to be fine in code as far as i know. Must be a bug or something. Which android studio version and constraint layout version are you using?
      • 2
    • AS 3.3, ConstraintLayout 1.1.2. 1.1.3 seems to work better but I can't have any preview in AS (all items have zero size and are on the top-left corner). 2.0.0-alpha3 solves both issues.

It seems to be a bug in ConstraintLayout 1.1.2. It has been fixed in 1.1.3, although 1.1.3 may have some other issues with displaying previews in Android Studio. ConstraintLayout 2.0.0-alpha3 also produces a nice preview.

  • 1
Reply Report
      • 2
    • I'm in shock that this is caused by Android library bug!!! It drove me crazy for such a simple thing!