Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

[Flow] Chain wrapping produces unexpected results with layout_constraintWidth_min #788

Open
smelfungus opened this issue Feb 14, 2023 · 3 comments
Assignees
Labels
bug Something isn't working

Comments

@smelfungus
Copy link

Hello!
Having the following layout:

<?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">

  <androidx.constraintlayout.helper.widget.Flow
    android:layout_width="0dp"
    android:layout_height="0dp"
    app:constraint_referenced_ids="textViewA,textViewB"
    app:flow_wrapMode="chain"
    app:layout_constraintBottom_toBottomOf="parent"
    app:layout_constraintEnd_toEndOf="parent"
    app:layout_constraintStart_toStartOf="parent"
    app:layout_constraintTop_toTopOf="parent" />

  <TextView
    android:id="@+id/textViewA"
    android:layout_width="0dp"
    android:layout_height="wrap_content"
    android:background="?attr/colorPrimaryContainer"
    android:text="This text should shrink up to 120 dp"
    app:layout_constraintWidth_min="120dp" />

  <TextView
    android:id="@+id/textViewB"
    android:layout_width="400dp"
    android:layout_height="wrap_content"
    android:background="?attr/colorTertiaryContainer"
    android:text="This text should not shrink, layout_width is fixed" />

</androidx.constraintlayout.widget.ConstraintLayout>

Flow chain wrapping is showing unexpected behaviour:

studio64_w4X95kODg1.mp4

It would be nice to respect layout_constraintWidth_min and do a chain wrapping instead of clipping.

@smelfungus smelfungus added the bug Something isn't working label Feb 14, 2023
@jswong65
Copy link
Collaborator

Thanks for reporting the issue! However, we won't be able to fix this issue in the short term.
With the use case you shared, the Flow helper could be a better alternative.

@smelfungus
Copy link
Author

@jswong65 thank you for your answer! I'm facing this issue with androidx.constraintlayout.helper.widget.Flow. Is there any additional flow helper that may come to the rescue?

@jswong65
Copy link
Collaborator

The comment I made is actually for #786. Sorry for the sorry for the confusion.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
bug Something isn't working
Projects
None yet
Development

No branches or pull requests

3 participants