You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
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
As you can see, perfect squares... heres my try instead...
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...
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 ! :)
The text was updated successfully, but these errors were encountered:
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.
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
As you can see, perfect squares... heres my try instead...
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 ! :)
The text was updated successfully, but these errors were encountered: