What is the purpose of such code:
android:layout_height="-2"
Or
android:layout_width="-1"
How should I interpret such values? Are they in connection to layout_weight attribute?
Thanks
EDIT: My mistake, I misunderstood the question.
The negative values seem to represent match_parent, wrap_content, and fill_parent.
When -1 or -2 is applied, the view fills the screen just as it would for match_parent or fill_parent. When any number -3 or lower is applied, the behavior is the same as wrap_content.
The values are not related to the layout_weight, just the pre-defined constants for width and height in Android.
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With