What is negative value for width or height?
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.
精彩评论