IT. Expert System.

Android Reference

NinePatchDrawable


android.graphics.drawable

Class NinePatchDrawable



  • public class NinePatchDrawable
    extends Drawable
    A resizeable bitmap, with stretchable areas that you define. This type of image is defined in a .png file with a special format.

    Developer Guides

    For more information about how to use a NinePatchDrawable, read the Canvas and Drawables developer guide. For information about creating a NinePatch image file using the draw9patch tool, see the Draw 9-patch tool guide.

    • Constructor Detail

      • NinePatchDrawable

        public NinePatchDrawable(Resources res,
                         Bitmap bitmap,
                         byte[] chunk,
                         Rect padding,
                         String srcName)
        Create drawable from raw nine-patch data, setting initial target density based on the display metrics of the resources.
      • NinePatchDrawable

        public NinePatchDrawable(Resources res,
                         Bitmap bitmap,
                         byte[] chunk,
                         Rect padding,
                         Rect layoutInsets,
                         String srcName)
        Create drawable from raw nine-patch data, setting initial target density based on the display metrics of the resources.
      • NinePatchDrawable

        public NinePatchDrawable(Resources res,
                         NinePatch patch)
        Create drawable from existing nine-patch, setting initial target density based on the display metrics of the resources.
    • Method Detail

      • setTargetDensity

        public void setTargetDensity(Canvas canvas)
        Set the density scale at which this drawable will be rendered. This method assumes the drawable will be rendered at the same density as the specified canvas.
        Parameters:
        canvas - The Canvas from which the density scale must be obtained.
        See Also:
        Bitmap.setDensity(int), Bitmap.getDensity()
      • setTargetDensity

        public void setTargetDensity(int density)
        Set the density at which this drawable will be rendered.
        Parameters:
        density - The density scale for this drawable.
        See Also:
        Bitmap.setDensity(int), Bitmap.getDensity()
      • draw

        public void draw(Canvas canvas)
        Description copied from class: Drawable
        Draw in its bounds (set via setBounds) respecting optional effects such as alpha (set via setAlpha) and color filter (set via setColorFilter).
        Specified by:
        draw in class Drawable
        Parameters:
        canvas - The canvas to draw into
      • getChangingConfigurations

        public int getChangingConfigurations()
        Description copied from class: Drawable
        Return a mask of the configuration parameters for which this drawable may change, requiring that it be re-created. The default implementation returns whatever was provided through Drawable.setChangingConfigurations(int) or 0 by default. Subclasses may extend this to or in the changing configurations of any other drawables they hold.
        Overrides:
        getChangingConfigurations in class Drawable
        Returns:
        Returns a mask of the changing configuration parameters, as defined by Configuration.
        See Also:
        Configuration
      • getPadding

        public boolean getPadding(Rect padding)
        Description copied from class: Drawable
        Return in padding the insets suggested by this Drawable for placing content inside the drawable's bounds. Positive values move toward the center of the Drawable (set Rect.inset). Returns true if this drawable actually has a padding, else false. When false is returned, the padding is always set to 0.
        Overrides:
        getPadding in class Drawable
      • getLayoutInsets

        public Insets getLayoutInsets()
        Description copied from class: Drawable
        Return in insets the layout insets suggested by this Drawable for use with alignment operations during layout.
        Overrides:
        getLayoutInsets in class Drawable
      • setAlpha

        public void setAlpha(int alpha)
        Description copied from class: Drawable
        Specify an alpha value for the drawable. 0 means fully transparent, and 255 means fully opaque.
        Specified by:
        setAlpha in class Drawable
      • setColorFilter

        public void setColorFilter(ColorFilter cf)
        Description copied from class: Drawable
        Specify an optional colorFilter for the drawable. Pass null to remove any filters.
        Specified by:
        setColorFilter in class Drawable
      • setDither

        public void setDither(boolean dither)
        Description copied from class: Drawable
        Set to true to have the drawable dither its colors when drawn to a device with fewer than 8-bits per color component. This can improve the look on those devices, but can also slow down the drawing a little.
        Overrides:
        setDither in class Drawable
      • setFilterBitmap

        public void setFilterBitmap(boolean filter)
        Description copied from class: Drawable
        Set to true to have the drawable filter its bitmap when scaled or rotated (for drawables that use bitmaps). If the drawable does not use bitmaps, this call is ignored. This can improve the look when scaled or rotated, but also slows down the drawing.
        Overrides:
        setFilterBitmap in class Drawable
      • getPaint

        public Paint getPaint()
      • getIntrinsicWidth

        public int getIntrinsicWidth()
        Retrieves the width of the source .png file (before resizing).
        Overrides:
        getIntrinsicWidth in class Drawable
      • getIntrinsicHeight

        public int getIntrinsicHeight()
        Retrieves the height of the source .png file (before resizing).
        Overrides:
        getIntrinsicHeight in class Drawable
      • getMinimumWidth

        public int getMinimumWidth()
        Description copied from class: Drawable
        Returns the minimum width suggested by this Drawable. If a View uses this Drawable as a background, it is suggested that the View use at least this value for its width. (There will be some scenarios where this will not be possible.) This value should INCLUDE any padding.
        Overrides:
        getMinimumWidth in class Drawable
        Returns:
        The minimum width suggested by this Drawable. If this Drawable doesn't have a suggested minimum width, 0 is returned.
      • getMinimumHeight

        public int getMinimumHeight()
        Description copied from class: Drawable
        Returns the minimum height suggested by this Drawable. If a View uses this Drawable as a background, it is suggested that the View use at least this value for its height. (There will be some scenarios where this will not be possible.) This value should INCLUDE any padding.
        Overrides:
        getMinimumHeight in class Drawable
        Returns:
        The minimum height suggested by this Drawable. If this Drawable doesn't have a suggested minimum height, 0 is returned.
      • getTransparentRegion

        public Region getTransparentRegion()
        Description copied from class: Drawable
        Returns a Region representing the part of the Drawable that is completely transparent. This can be used to perform drawing operations, identifying which parts of the target will not change when rendering the Drawable. The default implementation returns null, indicating no transparent region; subclasses can optionally override this to return an actual Region if they want to supply this optimization information, but it is not required that they do so.
        Overrides:
        getTransparentRegion in class Drawable
        Returns:
        Returns null if the Drawables has no transparent region to report, else a Region holding the parts of the Drawable's bounds that are transparent.
      • mutate

        public Drawable mutate()
        Description copied from class: Drawable
        Make this drawable mutable. This operation cannot be reversed. A mutable drawable is guaranteed to not share its state with any other drawable. This is especially useful when you need to modify properties of drawables loaded from resources. By default, all drawables instances loaded from the same resource share a common state; if you modify the state of one instance, all the other instances will receive the same modification. Calling this method on a mutable Drawable will have no effect.
        Overrides:
        mutate in class Drawable
        Returns:
        This drawable.
        See Also:
        Drawable.ConstantState, Drawable.getConstantState()


Content

Android Reference

Java basics

Java Enterprise Edition (EE)

Java Standard Edition (SE)

SQL

HTML

PHP

CSS

Java Script

MYSQL

JQUERY

VBS

REGEX

C

C++

C#

Design patterns

RFC (standard status)

RFC (proposed standard status)

RFC (draft standard status)

RFC (informational status)

RFC (experimental status)

RFC (best current practice status)

RFC (historic status)

RFC (unknown status)

IT dictionary

License.
All information of this service is derived from the free sources and is provided solely in the form of quotations. This service provides information and interfaces solely for the familiarization (not ownership) and under the "as is" condition.
Copyright 2016 © ELTASK.COM. All rights reserved.
Site is optimized for mobile devices.
Downloads: 10406 / 248537390. Delta: 0.02116 с