lightbulb_outline Please take our October 2018 developer survey. Start survey

Magnifier

public final class Magnifier
extends Object

java.lang.Object
   ↳ android.widget.Magnifier


Android magnifier widget. Can be used by any view which is attached to a window.

This method must be called on the thread that originally created this UI element. This is typically the main thread of your app.

Summary

Public constructors

Magnifier(View view)

Initializes a magnifier.

Public methods

void dismiss()

Dismisses the magnifier from the screen.

int getHeight()
int getWidth()
float getZoom()
void show(float xPosInView, float yPosInView)

Shows the magnifier on the screen.

void update()

Forces the magnifier to update its content.

Inherited methods

Public constructors

Magnifier

added in API level 28
public Magnifier (View view)

Initializes a magnifier.

Parameters
view View: the view for which this magnifier is attached

This value must never be null.

Public methods

dismiss

added in API level 28
public void dismiss ()

Dismisses the magnifier from the screen. Calling this on a dismissed magnifier is a no-op.

getHeight

added in API level 28
public int getHeight ()

Returns
int The height of the magnifier window, in pixels.

getWidth

added in API level 28
public int getWidth ()

Returns
int The width of the magnifier window, in pixels.

getZoom

added in API level 28
public float getZoom ()

Returns
float The zoom applied to the magnified view region copied to the magnifier window. If the zoom is x and the magnifier window size is (width, height), the original size of the content copied in the magnifier will be (width / x, height / x).

show

added in API level 28
public void show (float xPosInView, 
                float yPosInView)

Shows the magnifier on the screen.

Parameters
xPosInView float: horizontal coordinate of the center point of the magnifier source relative to the view. The lower end is clamped to 0 and the higher end is clamped to the view width.

Value is 0.0 or greater.

yPosInView float: vertical coordinate of the center point of the magnifier source relative to the view. The lower end is clamped to 0 and the higher end is clamped to the view height.

Value is 0.0 or greater.

update

added in API level 28
public void update ()

Forces the magnifier to update its content. It uses the previous coordinates passed to show(float, float). This only happens if the magnifier is currently showing.