Sdílet prostřednictvím


AdaptiveIconDrawable Class

Definition

This class can also be created via XML inflation using <adaptive-icon> tag in addition to dynamic creation.

[Android.Runtime.Register("android/graphics/drawable/AdaptiveIconDrawable", ApiSince=26, DoNotGenerateAcw=true)]
public class AdaptiveIconDrawable : Android.Graphics.Drawables.Drawable, Android.Graphics.Drawables.Drawable.ICallback, IDisposable, Java.Interop.IJavaPeerable
[<Android.Runtime.Register("android/graphics/drawable/AdaptiveIconDrawable", ApiSince=26, DoNotGenerateAcw=true)>]
type AdaptiveIconDrawable = class
    inherit Drawable
    interface Drawable.ICallback
    interface IJavaObject
    interface IDisposable
    interface IJavaPeerable
Inheritance
AdaptiveIconDrawable
Attributes
Implements

Remarks

This class can also be created via XML inflation using &lt;adaptive-icon> tag in addition to dynamic creation.

This drawable supports two drawable layers: foreground and background. The layers are clipped when rendering using the mask defined in the device configuration.

<ul> <li>Both foreground and background layers should be sized at 108 x 108 dp.</li> <li>The inner 72 x 72 dp of the icon appears within the masked viewport.</li> <li>The outer 18 dp on each of the 4 sides of the layers is reserved for use by the system UI surfaces to create interesting visual effects, such as parallax or pulsing.</li> </ul>

Such motion effect is achieved by internally setting the bounds of the foreground and background layer as following:

Rect(getBounds().left - getBounds().getWidth() * #getExtraInsetFraction(),
                 getBounds().top - getBounds().getHeight() * #getExtraInsetFraction(),
                 getBounds().right + getBounds().getWidth() * #getExtraInsetFraction(),
                 getBounds().bottom + getBounds().getHeight() * #getExtraInsetFraction())

An alternate drawable can be specified using &lt;monochrome> tag which can be drawn in place of the two (background and foreground) layers. This drawable is tinted according to the device or surface theme.

Java documentation for android.graphics.drawable.AdaptiveIconDrawable.

Portions of this page are modifications based on work created and shared by the Android Open Source Project and used according to terms described in the Creative Commons 2.5 Attribution License.

Constructors

AdaptiveIconDrawable(Drawable, Drawable, Drawable)

Constructor used to dynamically create this drawable.

AdaptiveIconDrawable(Drawable, Drawable)

Constructor used to dynamically create this drawable.

AdaptiveIconDrawable(IntPtr, JniHandleOwnership)

Properties

Alpha

Gets the current alpha value for the drawable.

(Inherited from Drawable)
AutoMirrored

Tells if this Drawable will be automatically mirrored when its layout direction is RTL right-to-left. -or- Set whether this Drawable is automatically mirrored when its layout direction is RTL (right-to left).

(Inherited from Drawable)
Background

Returns the foreground drawable managed by this class.

Bounds

Return the drawable's bounds Rect. -or- Specify a bounding rectangle for the Drawable.

(Inherited from Drawable)
Callback

Return the current Callback implementation attached to this Drawable.

(Inherited from Drawable)
ChangingConfigurations

Return a mask of the configuration parameters for which this drawable may change, requiring that it be re-created. -or- Set a mask of the configuration parameters for which this drawable may change, requiring that it be re-created.

(Inherited from Drawable)
Class

Returns the runtime class of this Object.

(Inherited from Object)
ColorFilter

Returns the current color filter, or null if none set.

(Inherited from Drawable)
Current (Inherited from Drawable)
DirtyBounds

Return the drawable's dirty bounds Rect.

(Inherited from Drawable)
ExtraInsetFraction

All four sides of the layers are padded with extra inset so as to provide extra content to reveal within the clip path when performing affine transformations on the layers.

Foreground

Returns the foreground drawable managed by this class.

Handle

The handle to the underlying Android instance.

(Inherited from Object)
HasFocusStateSpecified

Indicates whether this drawable has at least one state spec explicitly specifying android.R.attr#state_focused.

(Inherited from Drawable)
IconMask

When called before the bound is set, the returned path is identical to R.

IntrinsicHeight

Returns the drawable's intrinsic height.

(Inherited from Drawable)
IntrinsicWidth

Returns the drawable's intrinsic width.

(Inherited from Drawable)
IsFilterBitmap (Inherited from Drawable)
IsProjected

Whether this drawable requests projection.

(Inherited from Drawable)
IsStateful

Indicates whether this drawable will change its appearance based on state.

(Inherited from Drawable)
IsVisible (Inherited from Drawable)
JniIdentityHashCode (Inherited from Object)
JniPeerMembers
LayoutDirection

Returns the resolved layout direction for this Drawable.

(Inherited from Drawable)
Level

Retrieve the current level.

(Inherited from Drawable)
MinimumHeight

Returns the minimum height suggested by this Drawable.

(Inherited from Drawable)
MinimumWidth

Returns the minimum width suggested by this Drawable.

(Inherited from Drawable)
Monochrome

Returns the monochrome version of this drawable.

Opacity
OpticalInsets

Return in insets the layout insets suggested by this Drawable for use with alignment operations during layout.

(Inherited from Drawable)
PeerReference (Inherited from Object)
ThresholdClass
ThresholdType
TransparentRegion

Returns a Region representing the part of the Drawable that is completely transparent.

(Inherited from Drawable)

Methods

ApplyTheme(Resources+Theme)

Applies the specified theme to this Drawable and its children.

(Inherited from Drawable)
CanApplyTheme() (Inherited from Drawable)
ClearColorFilter()

Removes the color filter for this drawable.

(Inherited from Drawable)
Clone()

Creates and returns a copy of this object.

(Inherited from Object)
CopyBounds()

Return a copy of the drawable's bounds in a new Rect.

(Inherited from Drawable)
CopyBounds(Rect)

Return a copy of the drawable's bounds in the specified Rect (allocated by the caller).

(Inherited from Drawable)
Dispose() (Inherited from Object)
Dispose(Boolean) (Inherited from Object)
Draw(Canvas)
Equals(Object)

Indicates whether some other object is "equal to" this one.

(Inherited from Object)
GetConstantState()

Return a ConstantState instance that holds the shared state of this Drawable.

(Inherited from Drawable)
GetHashCode()

Returns a hash code value for the object.

(Inherited from Object)
GetHotspotBounds(Rect)

Populates outRect with the hotspot bounds.

(Inherited from Drawable)
GetOutline(Outline)

Called to get the drawable to populate the Outline that defines its drawing area.

(Inherited from Drawable)
GetPadding(Rect)

Return in padding the insets suggested by this Drawable for placing content inside the drawable's bounds.

(Inherited from Drawable)
GetState()

Describes the current state, as a union of primitve states, such as android.R.attr#state_focused, android.R.attr#state_selected, etc.

(Inherited from Drawable)
Inflate(Resources, XmlReader, IAttributeSet, Resources+Theme)

Inflate this Drawable from an XML resource.

(Inherited from Drawable)
Inflate(Resources, XmlReader, IAttributeSet)

Inflate this Drawable from an XML resource.

(Inherited from Drawable)
InflateAsync(Resources, XmlReader, IAttributeSet, Resources+Theme) (Inherited from Drawable)
InflateAsync(Resources, XmlReader, IAttributeSet) (Inherited from Drawable)
InvalidateDrawable(Drawable)
InvalidateSelf()

Use the current Callback implementation to have this Drawable redrawn.

(Inherited from Drawable)
JavaFinalize()

Called by the garbage collector on an object when garbage collection determines that there are no more references to the object.

(Inherited from Object)
JumpToCurrentState()

If this Drawable does transition animations between states, ask that it immediately jump to the current state and skip any active animations.

(Inherited from Drawable)
Mutate()

Make this drawable mutable.

(Inherited from Drawable)
Notify()

Wakes up a single thread that is waiting on this object's monitor.

(Inherited from Object)
NotifyAll()

Wakes up all threads that are waiting on this object's monitor.

(Inherited from Object)
OnBoundsChange(Rect)

Override this in your subclass to change appearance if you vary based on the bounds.

(Inherited from Drawable)
OnLayoutDirectionChanged(Int32)

Called when the drawable's resolved layout direction changes.

(Inherited from Drawable)
OnLevelChange(Int32)

Override this in your subclass to change appearance if you vary based on level.

(Inherited from Drawable)
OnStateChange(Int32[])

Override this in your subclass to change appearance if you recognize the specified state.

(Inherited from Drawable)
ScheduleDrawable(Drawable, IRunnable, Int64)
ScheduleSelf(Action, Int64) (Inherited from Drawable)
ScheduleSelf(IRunnable, Int64)

Use the current Callback implementation to have this Drawable scheduled.

(Inherited from Drawable)
SetAlpha(Int32)
SetBounds(Int32, Int32, Int32, Int32)

Specify a bounding rectangle for the Drawable.

(Inherited from Drawable)
SetCallback(Drawable+ICallback)

Bind a Callback object to this Drawable.

(Inherited from Drawable)
SetColorFilter(Color, PorterDuff+Mode)

Specify a color and Porter-Duff mode to be the color filter for this drawable.

(Inherited from Drawable)
SetColorFilter(ColorFilter)
SetDither(Boolean)

Set to true to have the drawable dither its colors when drawn to a device with fewer than 8-bits per color component.

(Inherited from Drawable)
SetFilterBitmap(Boolean)

Set to true to have the drawable filter its bitmaps with bilinear sampling when they are scaled or rotated.

(Inherited from Drawable)
SetHandle(IntPtr, JniHandleOwnership)

Sets the Handle property.

(Inherited from Object)
SetHotspot(Single, Single)

Specifies the hotspot's location within the drawable.

(Inherited from Drawable)
SetHotspotBounds(Int32, Int32, Int32, Int32)

Sets the bounds to which the hotspot is constrained, if they should be different from the drawable bounds.

(Inherited from Drawable)
SetLayoutDirection(LayoutDirection)

Set the layout direction for this drawable.

(Inherited from Drawable)
SetLevel(Int32)

Specify the level for the drawable.

(Inherited from Drawable)
SetOpacity(Int32)
SetState(Int32[])

Specify a set of states for the drawable.

(Inherited from Drawable)
SetTint(Int32)

Specifies tint color for this drawable.

(Inherited from Drawable)
SetTintBlendMode(BlendMode)

Specifies a tint blending mode for this drawable.

(Inherited from Drawable)
SetTintList(ColorStateList)

Specifies tint color for this drawable as a color state list.

(Inherited from Drawable)
SetTintMode(PorterDuff+Mode)

Specifies a tint blending mode for this drawable.

(Inherited from Drawable)
SetVisible(Boolean, Boolean)

Set whether this Drawable is visible.

(Inherited from Drawable)
ToArray<T>() (Inherited from Object)
ToString()

Returns a string representation of the object.

(Inherited from Object)
UnregisterFromRuntime() (Inherited from Object)
UnscheduleDrawable(Drawable, IRunnable)
UnscheduleSelf(Action) (Inherited from Drawable)
UnscheduleSelf(IRunnable)

Use the current Callback implementation to have this Drawable unscheduled.

(Inherited from Drawable)
Wait()

Causes the current thread to wait until it is awakened, typically by being <em>notified</em> or <em>interrupted</em>.

(Inherited from Object)
Wait(Int64, Int32)

Causes the current thread to wait until it is awakened, typically by being <em>notified</em> or <em>interrupted</em>, or until a certain amount of real time has elapsed.

(Inherited from Object)
Wait(Int64)

Causes the current thread to wait until it is awakened, typically by being <em>notified</em> or <em>interrupted</em>, or until a certain amount of real time has elapsed.

(Inherited from Object)

Explicit Interface Implementations

IJavaPeerable.Disposed() (Inherited from Object)
IJavaPeerable.DisposeUnlessReferenced() (Inherited from Object)
IJavaPeerable.Finalized() (Inherited from Object)
IJavaPeerable.JniManagedPeerState (Inherited from Object)
IJavaPeerable.SetJniIdentityHashCode(Int32) (Inherited from Object)
IJavaPeerable.SetJniManagedPeerState(JniManagedPeerStates) (Inherited from Object)
IJavaPeerable.SetPeerReference(JniObjectReference) (Inherited from Object)

Extension Methods

JavaCast<TResult>(IJavaObject)

Performs an Android runtime-checked type conversion.

JavaCast<TResult>(IJavaObject)
GetJniTypeName(IJavaPeerable)

Applies to