Code example for RelativeLayout.LayoutParams

Methods: addRule

         * Each layout manager has its own layout parameters that allow to 
         * express rules how a widgets should be positioned. The WRAP_CONTENT 
         * parameters specify that the widget should be sized to its natural 
         * size (for both width and height). 
        RelativeLayout.LayoutParams params = new RelativeLayout.LayoutParams(
                LayoutParams.WRAP_CONTENT, LayoutParams.WRAP_CONTENT);
         * Add a rule that specifies that the widget should be centered relative 
         * to the enclosing container. It is instructional to pass different 
         * layout parameters as defined in RelativeLayout (such as 
         * RelativeLayout.ALIGN_PARENT_BOTTOM). 
         * Add the label as a child to the RelativeLayout using the specific 
         * layout parameters. 
        layout.addView(label, params);
Contextual code suggestions in your IDE  Get Codota for Java