def apply_layout(self, child, layout):
        """ Apply a layout to a child. This sets the layout_params
        of the child which is later used during the `init_layout` pass.
        Subclasses should override this as needed to handle layout specific
        needs of the ViewGroup.
        
        Parameters
        ----------
        child: AndroidView
            A view to create layout params for.
        layout: Dict
            A dict of layout parameters to use to create the layout.
        
        """
        layout_params = child.layout_params
        if not layout_params:
            layout_params = self.create_layout_params(child, layout)
        w = child.widget
        if w:
            dp = self.dp
            # padding
            if 'padding' in layout:
                l, t, r, b = layout['padding']
                w.setPadding(int(l*dp), int(t*dp),
                             int(r*dp), int(b*dp))

            # left, top, right, bottom
            if 'left' in layout:
                w.setLeft(int(layout['left']*dp))
            if 'top' in layout:
                w.setTop(int(layout['top']*dp))
            if 'right' in layout:
                w.setRight(int(layout['right']*dp))
            if 'bottom' in layout:
                w.setBottom(int(layout['bottom']*dp))

            # x, y, z
            if 'x' in layout:
                w.setX(layout['x']*dp)
            if 'y' in layout:
                w.setY(layout['y']*dp)
            if 'z' in layout:
                w.setZ(layout['z']*dp)

            # set min width and height
            # maximum is not supported by AndroidViews (without flexbox)
            if 'min_height' in layout:
                w.setMinimumHeight(int(layout['min_height']*dp))
            if 'min_width' in layout:
                w.setMinimumWidth(int(layout['min_width']*dp))

        child.layout_params = layout_params
def apply_layout ( self , child , layout ) : layout_params = child . layout_params if not layout_params : layout_params = self . create_layout_params ( child , layout ) w = child . widget if w : dp = self . dp if 'padding' in layout : l , t , r , b = layout [ 'padding' ] w . setPadding ( int ( l * dp ) , int ( t * dp ) , int ( r * dp ) , int ( b * dp ) ) if 'left' in layout : w . setLeft ( int ( layout [ 'left' ] * dp ) ) if 'top' in layout : w . setTop ( int ( layout [ 'top' ] * dp ) ) if 'right' in layout : w . setRight ( int ( layout [ 'right' ] * dp ) ) if 'bottom' in layout : w . setBottom ( int ( layout [ 'bottom' ] * dp ) ) if 'x' in layout : w . setX ( layout [ 'x' ] * dp ) if 'y' in layout : w . setY ( layout [ 'y' ] * dp ) if 'z' in layout : w . setZ ( layout [ 'z' ] * dp ) if 'min_height' in layout : w . setMinimumHeight ( int ( layout [ 'min_height' ] * dp ) ) if 'min_width' in layout : w . setMinimumWidth ( int ( layout [ 'min_width' ] * dp ) ) child . layout_params = layout_params
Apply a layout to a child. This sets the layout_params
        of the child which is later used during the `init_layout` pass.
        Subclasses should override this as needed to handle layout specific
        needs of the ViewGroup.
        
        Parameters
        ----------
        child: AndroidView
            A view to create layout params for.
        layout: Dict
            A dict of layout parameters to use to create the layout.