def set_layout(self, layout):
        """ Sets the LayoutParams of this widget. 
           
        Since the available properties that may be set for the layout params 
        depends on the parent, actual creation of the params is delegated to 
        the parent
        
        Parameters
        ----------
        layout: Dict
            A dict of layout parameters the parent should used to layout this
            child.  The widget defaults are updated with user passed values. 
        
        """
        # Update the layout with the widget defaults
        update = self.layout_params is not None
        params = self.default_layout.copy()
        params.update(layout)

        # Create the layout params
        parent = self.parent()

        if not isinstance(parent, AndroidView):
            # Root node
            parent = self
            update = True

        parent.apply_layout(self, params)
        if update:
            self.widget.setLayoutParams(self.layout_params)
Sets the LayoutParams of this widget. 
           
        Since the available properties that may be set for the layout params 
        depends on the parent, actual creation of the params is delegated to 
        the parent
        
        Parameters
        ----------
        layout: Dict
            A dict of layout parameters the parent should used to layout this
            child.  The widget defaults are updated with user passed values.