I have this code when I'm creating my popup
val width = ConstraintLayout.LayoutParams.MATCH_PARENT
The popup is showing up and have a full width as wanted. But for some reasons the width variable gets assigned -1 and I use that variable to populate other things in the popup so they get an negative width and don't show up. How come this gives back -1 when the popup gets full width?
public static final int MATCH_PARENT Special value for the height or width requested by a View. MATCH_PARENT means that the view wants to be as big as its parent, minus the parent's padding, if any. Introduced in API Level 8.
Constant Value: -1 (0xffffffff) (+)
To get the width of specific view, you can do as below :
int width = specificView.getWidth();