Update the documentation related to VD / AVD
fix:32705240 fix:32683765 fix:32831830 fix:32705244 Test: make offline-sdk-docs and view the HTML file. Merged-In: I6ae3e5850494f13a241b2e9e4d2c5b95d5199aae Change-Id: I6ae3e5850494f13a241b2e9e4d2c5b95d5199aae
This commit is contained in:
@ -15,14 +15,14 @@
|
||||
package android.graphics.drawable;
|
||||
|
||||
import android.animation.Animator;
|
||||
import android.animation.Animator.AnimatorListener;
|
||||
import android.animation.AnimatorInflater;
|
||||
import android.animation.AnimatorListenerAdapter;
|
||||
import android.animation.AnimatorSet;
|
||||
import android.animation.Animator.AnimatorListener;
|
||||
import android.animation.ObjectAnimator;
|
||||
import android.animation.PropertyValuesHolder;
|
||||
import android.animation.TimeInterpolator;
|
||||
import android.animation.ValueAnimator;
|
||||
import android.animation.ObjectAnimator;
|
||||
import android.annotation.NonNull;
|
||||
import android.annotation.Nullable;
|
||||
import android.app.ActivityThread;
|
||||
@ -55,8 +55,8 @@ import android.view.RenderNodeAnimatorSetHelper;
|
||||
import android.view.View;
|
||||
|
||||
import com.android.internal.R;
|
||||
|
||||
import com.android.internal.util.VirtualRefBasePtr;
|
||||
|
||||
import org.xmlpull.v1.XmlPullParser;
|
||||
import org.xmlpull.v1.XmlPullParserException;
|
||||
|
||||
@ -88,9 +88,77 @@ import java.util.ArrayList;
|
||||
* <a name="VDExample"></a>
|
||||
* <li><h4>XML for the VectorDrawable containing properties to be animated</h4>
|
||||
* <p>
|
||||
* Animations can be performed on both group and path attributes, which requires groups and paths to
|
||||
* have unique names in the same VectorDrawable. Groups and paths without animations do not need to
|
||||
* be named.
|
||||
* Animations can be performed on the animatable attributes in
|
||||
* {@link android.graphics.drawable.VectorDrawable}. These attributes will be animated by
|
||||
* {@link android.animation.ObjectAnimator}. The ObjectAnimator's target can be the root element,
|
||||
* a group element or a path element. The targeted elements need to be named uniquely within
|
||||
* the same VectorDrawable. Elements without animation do not need to be named.
|
||||
* </p>
|
||||
* <p>
|
||||
* Here are all the animatable attributes in {@link android.graphics.drawable.VectorDrawable}:
|
||||
* <table border="2" align="center" cellpadding="5">
|
||||
* <thead>
|
||||
* <tr>
|
||||
* <th>Element Name</th>
|
||||
* <th>Animatable attribute name</th>
|
||||
* </tr>
|
||||
* </thead>
|
||||
* <tr>
|
||||
* <td><vector></td>
|
||||
* <td>alpha</td>
|
||||
* </tr>
|
||||
* <tr>
|
||||
* <td rowspan="7"><group></td>
|
||||
* <td>rotation</td>
|
||||
* </tr>
|
||||
* <tr>
|
||||
* <td>pivotX</td>
|
||||
* </tr>
|
||||
* <tr>
|
||||
* <td>pivotY</td>
|
||||
* </tr>
|
||||
* <tr>
|
||||
* <td>scaleX</td>
|
||||
* </tr>
|
||||
* <tr>
|
||||
* <td>scaleY</td>
|
||||
* </tr>
|
||||
* <tr>
|
||||
* <td>translateX</td>
|
||||
* </tr>
|
||||
* <tr>
|
||||
* <td>translateY</td>
|
||||
* </tr>
|
||||
* <tr>
|
||||
* <td rowspan="8"><path></td>
|
||||
* <td>pathData</td>
|
||||
* </tr>
|
||||
* <tr>
|
||||
* <td>fillColor</td>
|
||||
* </tr>
|
||||
* <tr>
|
||||
* <td>strokeColor</td>
|
||||
* </tr>
|
||||
* <tr>
|
||||
* <td>strokeWidth</td>
|
||||
* </tr>
|
||||
* <tr>
|
||||
* <td>strokeAlpha</td>
|
||||
* </tr>
|
||||
* <tr>
|
||||
* <td>fillAlpha</td>
|
||||
* </tr>
|
||||
* <tr>
|
||||
* <td>trimPathStart</td>
|
||||
* </tr>
|
||||
* <tr>
|
||||
* <td>trimPathOffset</td>
|
||||
* </tr>
|
||||
* <tr>
|
||||
* <td><clip-path></td>
|
||||
* <td>pathData</td>
|
||||
* </tr>
|
||||
* </table>
|
||||
* </p>
|
||||
* Below is an example of a VectorDrawable defined in vectordrawable.xml. This VectorDrawable is
|
||||
* referred to by its file name (not including file suffix) in the
|
||||
@ -118,9 +186,8 @@ import java.util.ArrayList;
|
||||
* <li><h4>XML for AnimatedVectorDrawable</h4>
|
||||
* <p>
|
||||
* An AnimatedVectorDrawable element has a VectorDrawable attribute, and one or more target
|
||||
* element(s). The target elements can be the path or group to be animated. Each target element
|
||||
* contains a name attribute that references a property (of a path or a group) to animate, and an
|
||||
* animation attribute that points to an ObjectAnimator or an AnimatorSet.
|
||||
* element(s). The target element can specify its target by android:name attribute, and link the
|
||||
* target with the proper ObjectAnimator or AnimatorSet by android:animation attribute.
|
||||
* </p>
|
||||
* The following code sample defines an AnimatedVectorDrawable. Note that the names refer to the
|
||||
* groups and paths in the <a href="#VDExample">VectorDrawable XML above</a>.
|
||||
@ -173,7 +240,8 @@ import java.util.ArrayList;
|
||||
* merge the XML files from the previous examples into one XML file:
|
||||
* </p>
|
||||
* <pre>
|
||||
* <animated-vector xmlns:android="http://schemas.android.com/apk/res/android" >
|
||||
* <animated-vector xmlns:android="http://schemas.android.com/apk/res/android"
|
||||
* xmlns:aapt="http://schemas.android.com/aapt" >
|
||||
* <aapt:attr name="android:drawable">
|
||||
* <vector
|
||||
* android:height="64dp"
|
||||
|
@ -76,36 +76,27 @@ import dalvik.system.VMRuntime;
|
||||
* <dl>
|
||||
* <dt><code>android:name</code></dt>
|
||||
* <dd>Defines the name of this vector drawable.</dd>
|
||||
* <dd>Animatable : No.</dd>
|
||||
* <dt><code>android:width</code></dt>
|
||||
* <dd>Used to define the intrinsic width of the drawable.
|
||||
* This support all the dimension units, normally specified with dp.</dd>
|
||||
* <dd>Animatable : No.</dd>
|
||||
* <dt><code>android:height</code></dt>
|
||||
* <dd>Used to define the intrinsic height the drawable.
|
||||
* This support all the dimension units, normally specified with dp.</dd>
|
||||
* <dd>Animatable : No.</dd>
|
||||
* <dt><code>android:viewportWidth</code></dt>
|
||||
* <dd>Used to define the width of the viewport space. Viewport is basically
|
||||
* the virtual canvas where the paths are drawn on.</dd>
|
||||
* <dd>Animatable : No.</dd>
|
||||
* <dt><code>android:viewportHeight</code></dt>
|
||||
* <dd>Used to define the height of the viewport space. Viewport is basically
|
||||
* the virtual canvas where the paths are drawn on.</dd>
|
||||
* <dd>Animatable : No.</dd>
|
||||
* <dt><code>android:tint</code></dt>
|
||||
* <dd>The color to apply to the drawable as a tint. By default, no tint is applied.</dd>
|
||||
* <dd>Animatable : No.</dd>
|
||||
* <dt><code>android:tintMode</code></dt>
|
||||
* <dd>The Porter-Duff blending mode for the tint color. The default value is src_in.</dd>
|
||||
* <dd>Animatable : No.</dd>
|
||||
* <dd>The Porter-Duff blending mode for the tint color. Default is src_in.</dd>
|
||||
* <dt><code>android:autoMirrored</code></dt>
|
||||
* <dd>Indicates if the drawable needs to be mirrored when its layout direction is
|
||||
* RTL (right-to-left).</dd>
|
||||
* <dd>Animatable : No.</dd>
|
||||
* RTL (right-to-left). Default is false.</dd>
|
||||
* <dt><code>android:alpha</code></dt>
|
||||
* <dd>The opacity of this drawable.</dd>
|
||||
* <dd>Animatable : Yes.</dd>
|
||||
* <dd>The opacity of this drawable. Default is 1.0.</dd>
|
||||
* </dl></dd>
|
||||
* </dl>
|
||||
*
|
||||
@ -117,32 +108,24 @@ import dalvik.system.VMRuntime;
|
||||
* <dl>
|
||||
* <dt><code>android:name</code></dt>
|
||||
* <dd>Defines the name of the group.</dd>
|
||||
* <dd>Animatable : No.</dd>
|
||||
* <dt><code>android:rotation</code></dt>
|
||||
* <dd>The degrees of rotation of the group.</dd>
|
||||
* <dd>Animatable : Yes.</dd>
|
||||
* <dd>The degrees of rotation of the group. Default is 0.</dd>
|
||||
* <dt><code>android:pivotX</code></dt>
|
||||
* <dd>The X coordinate of the pivot for the scale and rotation of the group.
|
||||
* This is defined in the viewport space.</dd>
|
||||
* <dd>Animatable : Yes.</dd>
|
||||
* This is defined in the viewport space. Default is 0.</dd>
|
||||
* <dt><code>android:pivotY</code></dt>
|
||||
* <dd>The Y coordinate of the pivot for the scale and rotation of the group.
|
||||
* This is defined in the viewport space.</dd>
|
||||
* <dd>Animatable : Yes.</dd>
|
||||
* This is defined in the viewport space. Default is 0.</dd>
|
||||
* <dt><code>android:scaleX</code></dt>
|
||||
* <dd>The amount of scale on the X Coordinate.</dd>
|
||||
* <dd>Animatable : Yes.</dd>
|
||||
* <dd>The amount of scale on the X Coordinate. Default is 1.</dd>
|
||||
* <dt><code>android:scaleY</code></dt>
|
||||
* <dd>The amount of scale on the Y coordinate.</dd>
|
||||
* <dd>Animatable : Yes.</dd>
|
||||
* <dd>The amount of scale on the Y coordinate. Default is 1.</dd>
|
||||
* <dt><code>android:translateX</code></dt>
|
||||
* <dd>The amount of translation on the X coordinate.
|
||||
* This is defined in the viewport space.</dd>
|
||||
* <dd>Animatable : Yes.</dd>
|
||||
* This is defined in the viewport space. Default is 0.</dd>
|
||||
* <dt><code>android:translateY</code></dt>
|
||||
* <dd>The amount of translation on the Y coordinate.
|
||||
* This is defined in the viewport space.</dd>
|
||||
* <dd>Animatable : Yes.</dd>
|
||||
* This is defined in the viewport space. Default is 0.</dd>
|
||||
* </dl></dd>
|
||||
* </dl>
|
||||
*
|
||||
@ -152,58 +135,44 @@ import dalvik.system.VMRuntime;
|
||||
* <dl>
|
||||
* <dt><code>android:name</code></dt>
|
||||
* <dd>Defines the name of the path.</dd>
|
||||
* <dd>Animatable : No.</dd>
|
||||
* <dt><code>android:pathData</code></dt>
|
||||
* <dd>Defines path data using exactly same format as "d" attribute
|
||||
* in the SVG's path data. This is defined in the viewport space.</dd>
|
||||
* <dd>Animatable : Yes.</dd>
|
||||
* <dt><code>android:fillColor</code></dt>
|
||||
* <dd>Specifies the color used to fill the path. May be a color or, for SDK 24+, a color state list
|
||||
* or a gradient color (See {@link android.R.styleable#GradientColor}
|
||||
* and {@link android.R.styleable#GradientColorItem}).
|
||||
* If this property is animated, any value set by the animation will override the original value.
|
||||
* No path fill is drawn if this property is not specified.</dd>
|
||||
* <dd>Animatable : Yes.</dd>
|
||||
* <dt><code>android:strokeColor</code></dt>
|
||||
* <dd>Specifies the color used to draw the path outline. May be a color or, for SDK 24+, a color
|
||||
* state list or a gradient color (See {@link android.R.styleable#GradientColor}
|
||||
* and {@link android.R.styleable#GradientColorItem}).
|
||||
* If this property is animated, any value set by the animation will override the original value.
|
||||
* No path outline is drawn if this property is not specified.</dd>
|
||||
* <dd>Animatable : Yes.</dd>
|
||||
* <dt><code>android:strokeWidth</code></dt>
|
||||
* <dd>The width a path stroke.</dd>
|
||||
* <dd>Animatable : Yes.</dd>
|
||||
* <dd>The width a path stroke. Default is 0.</dd>
|
||||
* <dt><code>android:strokeAlpha</code></dt>
|
||||
* <dd>The opacity of a path stroke.</dd>
|
||||
* <dd>Animatable : Yes.</dd>
|
||||
* <dd>The opacity of a path stroke. Default is 1.</dd>
|
||||
* <dt><code>android:fillAlpha</code></dt>
|
||||
* <dd>The opacity to fill the path with.</dd>
|
||||
* <dd>Animatable : Yes.</dd>
|
||||
* <dd>The opacity to fill the path with. Default is 1.</dd>
|
||||
* <dt><code>android:trimPathStart</code></dt>
|
||||
* <dd>The fraction of the path to trim from the start, in the range from 0 to 1.</dd>
|
||||
* <dd>Animatable : Yes.</dd>
|
||||
* <dd>The fraction of the path to trim from the start, in the range from 0 to 1. Default is 0.</dd>
|
||||
* <dt><code>android:trimPathEnd</code></dt>
|
||||
* <dd>The fraction of the path to trim from the end, in the range from 0 to 1.</dd>
|
||||
* <dd>Animatable : Yes.</dd>
|
||||
* <dd>The fraction of the path to trim from the end, in the range from 0 to 1. Default is 1.</dd>
|
||||
* <dt><code>android:trimPathOffset</code></dt>
|
||||
* <dd>Shift trim region (allows showed region to include the start and end), in the range
|
||||
* from 0 to 1.</dd>
|
||||
* <dd>Animatable : Yes.</dd>
|
||||
* from 0 to 1. Default is 0.</dd>
|
||||
* <dt><code>android:strokeLineCap</code></dt>
|
||||
* <dd>Sets the linecap for a stroked path: butt, round, square.</dd>
|
||||
* <dd>Animatable : No.</dd>
|
||||
* <dd>Sets the linecap for a stroked path: butt, round, square. Default is butt.</dd>
|
||||
* <dt><code>android:strokeLineJoin</code></dt>
|
||||
* <dd>Sets the lineJoin for a stroked path: miter,round,bevel.</dd>
|
||||
* <dd>Animatable : No.</dd>
|
||||
* <dd>Sets the lineJoin for a stroked path: miter,round,bevel. Default is miter.</dd>
|
||||
* <dt><code>android:strokeMiterLimit</code></dt>
|
||||
* <dd>Sets the Miter limit for a stroked path.</dd>
|
||||
* <dd>Animatable : No.</dd>
|
||||
* <dd>Sets the Miter limit for a stroked path. Default is 4.</dd>
|
||||
* <dt><code>android:fillType</code></dt>
|
||||
* <dd>Sets the fillType for a path. The types can be either "evenOdd" or "nonZero". They behave the
|
||||
* same as SVG's "fill-rule" properties. For more details, see
|
||||
* <dd>For SDK 24+, sets the fillType for a path. The types can be either "evenOdd" or "nonZero". They behave the
|
||||
* same as SVG's "fill-rule" properties. Default is nonZero. For more details, see
|
||||
* <a href="https://www.w3.org/TR/SVG/painting.html#FillRuleProperty">FillRuleProperty</a></dd>
|
||||
* <dd>Animatable : No.</dd>
|
||||
* </dl></dd>
|
||||
*
|
||||
* </dl>
|
||||
|
Reference in New Issue
Block a user