共用方式為


Bitmap.Density Property

Definition

Returns the density for this bitmap. -or- Specifies the density for this bitmap.

public int Density { [Android.Runtime.Register("getDensity", "()I", "")] get; [Android.Runtime.Register("setDensity", "(I)V", "")] set; }
[<get: Android.Runtime.Register("getDensity", "()I", "")>]
[<set: Android.Runtime.Register("setDensity", "(I)V", "")>]
member this.Density : int with get, set

Property Value

A scaling factor of the default density or #DENSITY_NONE if the scaling factor is unknown.

Attributes

Remarks

Property getter documentation:

Returns the density for this bitmap.

The default density is the same density as the current display, unless the current application does not support different screen densities in which case it is android.util.DisplayMetrics#DENSITY_DEFAULT. Note that compatibility mode is determined by the application that was initially loaded into a process -- applications that share the same process should all have the same compatibility, or ensure they explicitly set the density of their bitmaps appropriately.

Java documentation for android.graphics.Bitmap.getDensity().

Property setter documentation:

Specifies the density for this bitmap. When the bitmap is drawn to a Canvas that also has a density, it will be scaled appropriately.

Java documentation for android.graphics.Bitmap.setDensity(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

See also