Check out SquareLayout , an Android library that provides a wrapper class for different layouts, Quadratic size without losing basic functionality.
Dimensions are calculated immediately before the layout is displayed , so there is no re-rendering or anything as such for customization after receiving the view.
To use the library, add it to your build.gradle file:
repositories { maven { url "https://maven.google.com" } } dependencies { compile 'com.github.kaushikthedeveloper:squarelayout:0.0.3' }
Your XML will look like this:
<com.kaushikthedeveloper.squarelayout.SquareLinearLayout android:layout_width="match_parent" android:layout_height="match_parent" />
Kaushik np
source share