GridLayout setUseDefaultMargins - top ranked examples from Open Source projects

These code examples were ranked by Codota’s semantic indexing as the best open source examples for GridLayout setUseDefaultMargins method.

This code example shows how to use the following methods:setLayoutDirection, addView, setAlignmentMode, setRowOrderPreserved, setUseDefaultMargins
        super.onViewCreated(view, savedInstanceState);
        currentView.addView(create(currentView.getContext()));
    } 
 
    public static View create(Context context) {
        GridLayout layout = new GridLayout(context);
        layout.setUseDefaultMargins(true);
        layout.setAlignmentMode(ALIGN_BOUNDS);
        layout.setRowOrderPreserved(false);
        layout.setLayoutDirection(View.LAYOUT_DIRECTION_RTL);
 
        Spec row1 = spec(0);
        Spec row2 = spec(1);
        Spec row3 = spec(2, BASELINE);
        Spec row4 = spec(3, BASELINE);
        Spec row5 = spec(2, 3, FILL); // allow the last two rows to overlap the middle two
        Spec row6 = spec(5);
        Spec row7 = spec(6);
 
        Spec col1a = spec(0, 4, CENTER);

8
CodeRank
This code example shows how to use the following methods:setLayoutDirection, addView, setAlignmentMode, setRowOrderPreserved, setUseDefaultMargins
        super.onViewCreated(view, savedInstanceState);
        currentView.addView(create(currentView.getContext()));
    } 
 
    public static View create(Context context) {
        GridLayout layout = new GridLayout(context);
        layout.setUseDefaultMargins(true);
        layout.setAlignmentMode(ALIGN_BOUNDS);
        layout.setRowOrderPreserved(false);
        layout.setLayoutDirection(View.LAYOUT_DIRECTION_LTR);
 
        Spec row1 = spec(0);
        Spec row2 = spec(1);
        Spec row3 = spec(2, BASELINE);
        Spec row4 = spec(3, BASELINE);
        Spec row5 = spec(2, 3, FILL); // allow the last two rows to overlap the middle two
        Spec row6 = spec(5);
        Spec row7 = spec(6);
 
        Spec col1a = spec(0, 4, CENTER);

8
CodeRank
This code example shows how to use the following methods:setLayoutDirection, addView, setAlignmentMode, setRowOrderPreserved, setUseDefaultMargins
        super.onViewCreated(view, savedInstanceState);
        currentView.addView(create(currentView.getContext()));
    } 
 
    public static View create(Context context) {
        GridLayout layout = new GridLayout(context);
        layout.setUseDefaultMargins(true);
        layout.setAlignmentMode(ALIGN_BOUNDS);
        layout.setRowOrderPreserved(false);
        layout.setLayoutDirection(View.LAYOUT_DIRECTION_RTL);
 
        Spec row1 = spec(0);
        Spec row2 = spec(1);
        Spec row3 = spec(2, BASELINE);
        Spec row4 = spec(3, BASELINE);
        Spec row5 = spec(2, 3, FILL); // allow the last two rows to overlap the middle two
        Spec row6 = spec(5);
        Spec row7 = spec(6);
 
        Spec col1a = spec(0, 4, CENTER);

6
CodeRank
This code example shows how to use the following methods:setLayoutDirection, addView, setAlignmentMode, setRowOrderPreserved, setUseDefaultMargins
        super.onViewCreated(view, savedInstanceState);
        currentView.addView(create(currentView.getContext()));
    } 
 
    public static View create(Context context) {
        GridLayout layout = new GridLayout(context);
        layout.setUseDefaultMargins(true);
        layout.setAlignmentMode(ALIGN_BOUNDS);
        layout.setRowOrderPreserved(false);
        layout.setLayoutDirection(View.LAYOUT_DIRECTION_LTR);
 
        Spec row1 = spec(0);
        Spec row2 = spec(1);
        Spec row3 = spec(2, BASELINE);
        Spec row4 = spec(3, BASELINE);
        Spec row5 = spec(2, 3, FILL); // allow the last two rows to overlap the middle two
        Spec row6 = spec(5);
        Spec row7 = spec(6);
 
        Spec col1a = spec(0, 4, CENTER);

6
CodeRank
setUseDefaultMargins Method Overview
When true, GridLayout allocates default margins around children based on the child's visual characteristics.
See Code Examples for other Android GridLayout Methods: