Stay organized with collections
    
    
      
      Save and categorize content based on your preferences.
    
  
  
    
  
  
  
  
    
    
    
  
  
    
    
    
    RectShape
    open class RectShape : Shape
    
    
    Defines a rectangle shape. 
     The rectangle can be drawn to a Canvas with its own draw() method, but more graphical control is available if you instead pass the RectShape to a android.graphics.drawable.ShapeDrawable.
    Summary
    
    
    
      
        
          | Protected methods | 
        
          | open Unit |  | 
        
          | RectF! | Returns the RectF that defines this rectangle's bounds. | 
      
    
    
    Public constructors
    
    Public methods
    
      clone
      
      open fun clone(): RectShape
      
      
        
          
            | Exceptions | 
          
            | java.lang.CloneNotSupportedException | if the object's class does not support the Cloneableinterface. Subclasses that override theclonemethod can also throw this exception to indicate that an instance cannot be cloned. | 
        
      
     
    
      draw
      
      open fun draw(
    canvas: Canvas!, 
    paint: Paint!
): Unit
      
        
          
            | Parameters | 
          
            | canvas | Canvas!: the Canvas within which this shape should be drawn | 
          
            | paint | Paint!: the Paint object that defines this shape's characteristics | 
        
      
     
    
      equals
      
      open fun equals(other: Any?): Boolean
      
        
          
            | Parameters | 
          
            | obj | the reference object with which to compare. | 
        
      
      
        
          
            | Return | 
          
            | Boolean | trueif this object is the same as the obj argument;falseotherwise. | 
        
      
     
    
      getOutline
      
      open fun getOutline(outline: Outline): Unit
      
        
          
            | Parameters | 
          
            | outline | Outline: the Outline to be populated with the result. Must be non- null. | 
        
      
     
    
      hashCode
      
      open fun hashCode(): Int
      
        
          
            | Return | 
          
            | Int | a hash code value for this object. | 
        
      
     
    Protected methods
    
      onResize
      
      protected open fun onResize(
    width: Float, 
    height: Float
): Unit
      
        
          
            | Parameters | 
          
            | width | Float: the new width of the Shape | 
          
            | height | Float: the new height of the Shape | 
        
      
     
    
      rect
      
      protected fun rect(): RectF!
      Returns the RectF that defines this rectangle's bounds.
     
  
  
  
    
  
 
  
    
      
      
    
    
      
    
    
  
       
    
    
      
    
  
  
  Content and code samples on this page are subject to the licenses described in the Content License. Java and OpenJDK are trademarks or registered trademarks of Oracle and/or its affiliates.
  Last updated 2025-02-10 UTC.
  
  
  
    
      [[["Easy to understand","easyToUnderstand","thumb-up"],["Solved my problem","solvedMyProblem","thumb-up"],["Other","otherUp","thumb-up"]],[["Missing the information I need","missingTheInformationINeed","thumb-down"],["Too complicated / too many steps","tooComplicatedTooManySteps","thumb-down"],["Out of date","outOfDate","thumb-down"],["Samples / code issue","samplesCodeIssue","thumb-down"],["Other","otherDown","thumb-down"]],["Last updated 2025-02-10 UTC."],[],[]]