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

Equally sized Childs on different screen sizes ? #465

Closed
genaray opened this issue Oct 15, 2018 · 1 comment
Closed

Equally sized Childs on different screen sizes ? #465

genaray opened this issue Oct 15, 2018 · 1 comment

Comments

@genaray
Copy link

genaray commented Oct 15, 2018

Good evening !

Im trying to adjust the flexbox childs to equally fit the same width and height. I honestly thought that would be easy... or that theres even an attribute... but i havent found any way to achieve this... As an example i took this instagram picture wall

screenshot_20181015-174235

As you can see, perfect squares... heres my try instead...

unbenannt

The width is always bigger than the height, this causes them to look a bit weierd... those are rectangles and not squares... i have no clue how i could achieve this goal on every screen size...

Heres my flexbox configuration
<com.google.android.flexbox.FlexboxLayout android:id="@+id/FlexBox" android:layout_width="match_parent" android:layout_height="wrap_content" android:layout_marginLeft="10dp" android:layout_marginTop="10dp" android:layout_marginRight="10dp" android:isScrollContainer="true" android:scrollbars="vertical" app:alignItems="stretch" app:flexDirection="row" app:flexWrap="wrap" app:layout_constraintBottom_toBottomOf="parent" app:layout_constraintEnd_toEndOf="parent" app:layout_constraintStart_toStartOf="parent" app:layout_constraintTop_toTopOf="parent" app:layout_constraintVertical_bias="0.0">

And here are my childs ( the standard, not the big ones )
<android.support.v7.widget.CardView android:layout_width="100dp" android:layout_height="100dp" android:layout_marginLeft="5dp" android:layout_marginTop="5dp" android:layout_marginRight="5dp" android:layout_marginBottom="5dp" android:minWidth="50dp" android:minHeight="50dp" app:cardCornerRadius="5dp" app:layout_flexGrow="1" app:layout_flexShrink="1" app:layout_maxHeight="200dp" app:layout_maxWidth="200dp" app:layout_minHeight="50dp" app:layout_minWidth="50dp">

So is there a way to make them scale 1:1 ? To obtain equally width and height ? Or what else could i try ?

Thanks for your help ! :)

@thagikura
Copy link
Contributor

Keeping the same size for the width and the height is not possible only with the FlexboxLayout.
It's possible if you wrap each child by ConstraintLayout and keep the dimention ratio as 1:1.

But let me close this since this is not an issue.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

2 participants