Code example for GridView

Methods: setColumnWidthsetNumColumns

0
            orientationLandscape(); 
        } 
    } 
 
    private void orientationPortrait() { 
        gridView.setNumColumns(1);
        gridView.setColumnWidth(RelativeLayout.LayoutParams.FILL_PARENT);
    } 
 
    private void orientationLandscape() { 
        gridView.setNumColumns(GridView.AUTO_FIT);
    } 
 
    private void determineOrientation() { 
        if(device.getCurrentOrientation() == Configuration.ORIENTATION_LANDSCAPE){
            orientationLandscape(); 
        } else if(device.getCurrentOrientation() == Configuration.ORIENTATION_PORTRAIT) {
            orientationPortrait(); 
        } 
    } 
Stop searching for code, let great code find you!  Add Codota to your java IDE