IT. Expert System.

Android Reference

View.DragShadowBuilder


android.view

Class View.DragShadowBuilder

  • Enclosing class:
    View


    public static class View.DragShadowBuilder
    extends Object
    Creates an image that the system displays during the drag and drop operation. This is called a "drag shadow". The default implementation for a DragShadowBuilder based on a View returns an image that has exactly the same appearance as the given View. The default also positions the center of the drag shadow directly under the touch point. If no View is provided (the constructor with no parameters is used), and onProvideShadowMetrics() and onDrawShadow() are not overriden, then the default is an invisible drag shadow.

    You are not required to use the View you provide to the constructor as the basis of the drag shadow. The onDrawShadow() method allows you to draw anything you want as the drag shadow.

    You pass a DragShadowBuilder object to the system when you start the drag. The system calls onProvideShadowMetrics() to get the size and position of the drag shadow. It uses this data to construct a Canvas object, then it calls onDrawShadow() so that your application can draw the shadow image in the Canvas.

    Developer Guides

    For a guide to implementing drag and drop features, read the Drag and Drop developer guide.

    • Constructor Detail

      • View.DragShadowBuilder

        public View.DragShadowBuilder(View view)
        Constructs a shadow image builder based on a View. By default, the resulting drag shadow will have the same appearance and dimensions as the View, with the touch point over the center of the View.
        Parameters:
        view - A View. Any View in scope can be used.
      • View.DragShadowBuilder

        public View.DragShadowBuilder()
        Construct a shadow builder object with no associated View. This constructor variant is only useful when the onProvideShadowMetrics(Point, Point) and onDrawShadow(Canvas) methods are also overridden in order to supply the drag shadow's dimensions and appearance without reference to any View object. If they are not overridden, then the result is an invisible drag shadow.
    • Method Detail

      • getView

        public final View getView()
        Returns the View object that had been passed to the View.DragShadowBuilder(View) constructor. If that View parameter was null or if the View.DragShadowBuilder() constructor was used to instantiate the builder object, this method will return null.
        Returns:
        The View object associate with this builder object.
      • onProvideShadowMetrics

        public void onProvideShadowMetrics(Point shadowSize,
                                  Point shadowTouchPoint)
        Provides the metrics for the shadow image. These include the dimensions of the shadow image, and the point within that shadow that should be centered under the touch location while dragging.

        The default implementation sets the dimensions of the shadow to be the same as the dimensions of the View itself and centers the shadow under the touch point.

        Parameters:
        shadowSize - A Point containing the width and height of the shadow image. Your application must set Point.x to the desired width and must set Point.y to the desired height of the image.
        shadowTouchPoint - A Point for the position within the shadow image that should be underneath the touch point during the drag and drop operation. Your application must set Point.x to the X coordinate and Point.y to the Y coordinate of this position.
      • onDrawShadow

        public void onDrawShadow(Canvas canvas)
        Draws the shadow image. The system creates the Canvas object based on the dimensions it received from the onProvideShadowMetrics(Point, Point) callback.
        Parameters:
        canvas - A Canvas object in which to draw the shadow image.


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: 2685 / . Delta: 0.02427 с