Class BackgroundGrid


  • public final class BackgroundGrid
    extends Object
    BackgroundGrid determines what a view looks like without anything in it.
    Since:
    100.0.0
    • Constructor Summary

      Constructors 
      Constructor Description
      BackgroundGrid()
      Creates a background grid with default values.
      BackgroundGrid​(int color, int gridLineColor, float gridLineWidth, float gridSize)
      Creates a new instance of BackgroundGrid with the specified color, grid line color, grid line width and grid size.
    • Constructor Detail

      • BackgroundGrid

        public BackgroundGrid()
        Creates a background grid with default values.
        Since:
        100.0.0
      • BackgroundGrid

        public BackgroundGrid​(int color,
                              int gridLineColor,
                              float gridLineWidth,
                              float gridSize)
        Creates a new instance of BackgroundGrid with the specified color, grid line color, grid line width and grid size.
        Parameters:
        color - an integer representing the background color as 0xAARRGGBB
        gridLineColor - an integer representing the grid line color as 0xAARRGGBB
        gridLineWidth - the grid line width in density-independent pixels (dp)
        gridSize - the grid size in density-independent pixels (dp)
        Throws:
        IllegalArgumentException - if gridLineWidth is less than zero
        IllegalArgumentException - if the gridSize is less than or equal to one *
        Since:
        100.0.0
    • Method Detail

      • getColor

        public int getColor()
        Gets the color of the background.
        Returns:
        an integer representing the color as 0xAARRGGBB. Default is gray - 0xFFC0C0C0.
        Since:
        100.0.0
        See Also:
        setColor(int)
      • setColor

        public void setColor​(int argb)
        Sets the color of the background.
        Parameters:
        argb - the color in the format 0xAARRGGBB
        Since:
        100.0.0
        See Also:
        getColor()
      • getGridLineColor

        public int getGridLineColor()
        Gets the background grid line color.
        Returns:
        an integer representing the grid line color as 0xAARRGGBB. Default is black - 0xFF000000.
        Since:
        100.0.0
        See Also:
        setGridLineColor(int)
      • setGridLineColor

        public void setGridLineColor​(int argb)
        Sets the background grid line color.
        Parameters:
        argb - the color in the format 0xAARRGGBB
        Since:
        100.0.0
        See Also:
        getGridLineColor()
      • getGridLineWidth

        public float getGridLineWidth()
        Gets the background grid line width in density-independent pixels (dp).
        Returns:
        the grid line width in dp. Default is 0.1.
        Since:
        100.0.0
        See Also:
        setGridLineColor(int)
      • setGridLineWidth

        public void setGridLineWidth​(float gridLineWidth)
        Sets the background grid line width in density-independent pixels (dp).
        Parameters:
        gridLineWidth - grid line width in dp. Must be greater than or equal to 0. Setting to 0 makes grid lines invisible.
        Throws:
        IllegalArgumentException - if the gridLineWidth is less than 0
        Since:
        100.0.0
        See Also:
        getGridLineWidth()
      • getGridSize

        public float getGridSize()
        Gets the size of each background grid square, in density-independent pixels (dp).
        Returns:
        the grid size in dp. Default is 20 * 20 dp.
        Since:
        100.0.0
      • setGridSize

        public void setGridSize​(float gridSize)
        Sets the size of each background grid square, in density-independent pixels (dp). The background grid size must be greater than 1.
        Parameters:
        gridSize - grid size in dp
        Throws:
        IllegalArgumentException - if the gridSize is less than or equal to one
        Since:
        100.0.0
      • isVisible

        public boolean isVisible()
        Gets whether the grid lines are visible or not.
        Returns:
        true if grid lines are visible; false otherwise. If true, grid lines display on top of the background. (To set the background color/opacity, see setColor(int).) If false, the background displays without the grid lines.
        Since:
        100.7.0
        See Also:
        setVisible(boolean)
      • setVisible

        public void setVisible​(boolean visible)
        Sets the grid lines visible or not.
        Parameters:
        visible - true to display grid lines on top of the background, false to display background without the grid lines. (To set the background color/opacity, see setColor(int).)
        Since:
        100.7.0
        See Also:
        isVisible()