Can any body tell me what is the unit of the onMeasure parameter (int widthMeasureSpec, int heightMeasureSpec) this View Class Method.
I print a magazine, it returns me 1073742144, -2147483251 respectively.
The value is a combination of mode and size. Use View.MeasureSpec.getMode(widthMeasureSpec) to get the mode (one of MeasureSpec.EXACTLY , MeasureSpec.AT_MOST and MeasureSpec.UNSPECIFIED ); what you probably want to know is View.MeasureSpec.getSize(widthMeasureSpec) , the size in pixels.
View.MeasureSpec.getMode(widthMeasureSpec)
MeasureSpec.EXACTLY
MeasureSpec.AT_MOST
MeasureSpec.UNSPECIFIED
View.MeasureSpec.getSize(widthMeasureSpec)
See also the source code of MeasureSpec .
Source: https://habr.com/ru/post/896705/More articles:SetProgressBarIndeterminateVisibility lack of understanding - androidSolr Tag Tag Cloud - solrCSS link color not working - cssHow to make a div stack vertically and then horizontally first? - htmlThrow an exception but keep the stack trace - c #Which Java JSON libraries are good at repeating JAXB annotations? - javaFunction inside function in C - cHow to search in a BYTE array for a template? - c ++What happens if NSMutableArray is modified by multiple threads at the same time? (if the objects it contains are stored elsewhere) - multithreadingAdding TabBarController software - iosAll Articles