Compartir a través de


PackageManager.GetUserBadgedDrawableForDensity Method

Definition

If the target user is a managed profile of the calling user or the caller is itself a managed profile, then this returns a badged copy of the given drawable allowing the user to distinguish it from the original drawable.

[Android.Runtime.Register("getUserBadgedDrawableForDensity", "(Landroid/graphics/drawable/Drawable;Landroid/os/UserHandle;Landroid/graphics/Rect;I)Landroid/graphics/drawable/Drawable;", "GetGetUserBadgedDrawableForDensity_Landroid_graphics_drawable_Drawable_Landroid_os_UserHandle_Landroid_graphics_Rect_IHandler")]
public abstract Android.Graphics.Drawables.Drawable GetUserBadgedDrawableForDensity (Android.Graphics.Drawables.Drawable drawable, Android.OS.UserHandle user, Android.Graphics.Rect? badgeLocation, int badgeDensity);
[<Android.Runtime.Register("getUserBadgedDrawableForDensity", "(Landroid/graphics/drawable/Drawable;Landroid/os/UserHandle;Landroid/graphics/Rect;I)Landroid/graphics/drawable/Drawable;", "GetGetUserBadgedDrawableForDensity_Landroid_graphics_drawable_Drawable_Landroid_os_UserHandle_Landroid_graphics_Rect_IHandler")>]
abstract member GetUserBadgedDrawableForDensity : Android.Graphics.Drawables.Drawable * Android.OS.UserHandle * Android.Graphics.Rect * int -> Android.Graphics.Drawables.Drawable

Parameters

drawable
Drawable

The drawable to badge.

user
UserHandle

The target user.

badgeLocation
Rect

Where in the bounds of the badged drawable to place the badge. If it's null, the badge is applied on top of the entire drawable being badged.

badgeDensity
Int32

The optional desired density for the badge as per android.util.DisplayMetrics#densityDpi. If it's not positive, the density of the display is used.

Returns

A drawable that combines the original drawable and a badge as determined by the system.

Attributes

Remarks

If the target user is a managed profile of the calling user or the caller is itself a managed profile, then this returns a badged copy of the given drawable allowing the user to distinguish it from the original drawable. The caller can specify the location in the bounds of the drawable to be badged where the badge should be applied as well as the density of the badge to be used.

If the original drawable is a BitmapDrawable and the backing bitmap is mutable as per android.graphics.Bitmap#isMutable(), the badging is performed in place and the original drawable is returned.

Java documentation for android.content.pm.PackageManager.getUserBadgedDrawableForDensity(android.graphics.drawable.Drawable, android.os.UserHandle, android.graphics.Rect, int).

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.

Applies to